removed slider functions from torque.js to allow user to use any slider library
This commit is contained in:
parent
469a868f2c
commit
c492f9a0a8
@ -89,6 +89,28 @@
|
|||||||
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
|
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
|
||||||
map.setOptions({styles:map_style.google_maps_customization_style});
|
map.setOptions({styles:map_style.google_maps_customization_style});
|
||||||
|
|
||||||
|
|
||||||
|
function init_slider( that ){
|
||||||
|
var that_opts = that.options;
|
||||||
|
$('body').append('<div id="torque-slider"></div>');
|
||||||
|
// Init jQuery UI options
|
||||||
|
$("#torque-slider").slider({
|
||||||
|
min: Math.round(that_opts.start),
|
||||||
|
max: Math.floor(that_opts.end),
|
||||||
|
value: Math.round(that_opts.start),
|
||||||
|
step: that._step,
|
||||||
|
slide: function(event, ui){
|
||||||
|
that._current = ui.value;
|
||||||
|
var date = new Date(that._current * 1000);
|
||||||
|
var date_arry = date.toString().substr(4).split(' ');
|
||||||
|
that._display.set_time((that._current - that.start) / that._step);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
function on_move (that) {
|
||||||
|
$( "#torque-slider" ).slider({ value: that._current });
|
||||||
|
}
|
||||||
|
|
||||||
var TorqueOptions = {
|
var TorqueOptions = {
|
||||||
user:'viz2',
|
user:'viz2',
|
||||||
table:'ow',
|
table:'ow',
|
||||||
@ -103,7 +125,8 @@
|
|||||||
trails:true,
|
trails:true,
|
||||||
point_type:'circle',
|
point_type:'circle',
|
||||||
cellsize:1,
|
cellsize:1,
|
||||||
scrub: true,
|
scrub: init_slider,
|
||||||
|
scrub_move: on_move
|
||||||
}
|
}
|
||||||
|
|
||||||
var torque = null;
|
var torque = null;
|
||||||
|
@ -76,6 +76,26 @@
|
|||||||
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
|
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
|
||||||
map.setOptions({styles:map_style.google_maps_customization_style});
|
map.setOptions({styles:map_style.google_maps_customization_style});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function init_slider( that ){
|
||||||
|
var that_opts = that.options;
|
||||||
|
$('body').append('<div id="torque-slider"></div>');
|
||||||
|
// Init jQuery UI options
|
||||||
|
$("#torque-slider").slider({
|
||||||
|
min: Math.round(that_opts.start),
|
||||||
|
max: Math.floor(that_opts.end),
|
||||||
|
value: Math.round(that_opts.start),
|
||||||
|
step: that._step,
|
||||||
|
slide: function(event, ui){
|
||||||
|
that._current = ui.value;
|
||||||
|
var date = new Date(that._current * 1000);
|
||||||
|
var date_arry = date.toString().substr(4).split(' ');
|
||||||
|
that._display.set_time((that._current - that.start) / that._step);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
var TorqueOptions = {
|
var TorqueOptions = {
|
||||||
user: "viz2",
|
user: "viz2",
|
||||||
table: "us_po_offices",
|
table: "us_po_offices",
|
||||||
@ -91,7 +111,7 @@
|
|||||||
point_type:'circle',
|
point_type:'circle',
|
||||||
cellsize:2,
|
cellsize:2,
|
||||||
autoplay: false,
|
autoplay: false,
|
||||||
scrub: true
|
scrub: init_slider
|
||||||
}
|
}
|
||||||
|
|
||||||
var torque = null;
|
var torque = null;
|
||||||
|
@ -151,10 +151,9 @@ Torque.modules.layer = function (torque) {
|
|||||||
|
|
||||||
// If scrubbable, override other options that may have been set
|
// If scrubbable, override other options that may have been set
|
||||||
if (this.options.scrub){
|
if (this.options.scrub){
|
||||||
|
this.options.scrub(this);
|
||||||
// this.options.autoplay = false;
|
// this.options.autoplay = false;
|
||||||
// this.options.trails = false;
|
// this.options.trails = false;
|
||||||
$('body').append('<div id="torque-slider"></div>');
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.options.autoplay) {
|
if (this.options.autoplay) {
|
||||||
@ -162,7 +161,6 @@ Torque.modules.layer = function (torque) {
|
|||||||
this.play();
|
this.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
init_slider(this);
|
|
||||||
|
|
||||||
torque.log.info('Layer is now running!');
|
torque.log.info('Layer is now running!');
|
||||||
},
|
},
|
||||||
@ -234,8 +232,8 @@ Torque.modules.layer = function (torque) {
|
|||||||
|
|
||||||
this._display.set_time((this._current - this.start) / this._step);
|
this._display.set_time((this._current - this.start) / this._step);
|
||||||
|
|
||||||
if (this.options.scrub==true){
|
if (this.options.scrub_move){
|
||||||
$( "#torque-slider" ).slider({ value: this._current });
|
this.options.scrub_move(this)
|
||||||
}
|
}
|
||||||
if (this.running) {
|
if (this.running) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
@ -243,19 +241,19 @@ Torque.modules.layer = function (torque) {
|
|||||||
}.bind(this), pause + 1000 * 1 / this.options.fps);
|
}.bind(this), pause + 1000 * 1 / this.options.fps);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scrub:function(scrub_current){
|
// scrub:function(scrub_current){
|
||||||
this._current = scrub_current;
|
// this._current = scrub_current;
|
||||||
var date = new Date(this._current * 1000);
|
// var date = new Date(this._current * 1000);
|
||||||
var date_arry = date.toString().substr(4).split(' ');
|
// var date_arry = date.toString().substr(4).split(' ');
|
||||||
torque.clock.set('<span id="month">' + date_arry[0] + '</span> <span id="year">' + date_arry[2] + '</span>');
|
// torque.clock.set('<span id="month">' + date_arry[0] + '</span> <span id="year">' + date_arry[2] + '</span>');
|
||||||
|
|
||||||
if (this.options.subtitles) {
|
// if (this.options.subtitles) {
|
||||||
torque.subtitles.set(date);
|
// torque.subtitles.set(date);
|
||||||
}
|
// }
|
||||||
|
|
||||||
this._display.set_time((this._current - this.start) / this._step);
|
// this._display.set_time((this._current - this.start) / this._step);
|
||||||
|
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,20 +336,6 @@ Torque.modules.subtitles = function (torque) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function init_slider( that ){
|
|
||||||
var that_opts = that.options;
|
|
||||||
// Init jQuery UI options
|
|
||||||
$("#torque-slider").slider({
|
|
||||||
min: Math.round(that_opts.start),
|
|
||||||
max: Math.floor(that_opts.end),
|
|
||||||
value: Math.round(that_opts.start),
|
|
||||||
step: that._step,
|
|
||||||
slide: function(event, ui){
|
|
||||||
that.scrub(ui.value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logging module that torquetes log messages to the console and to the Speed
|
* Logging module that torquetes log messages to the console and to the Speed
|
||||||
* Tracer API. It contains convenience methods for info(), warn(), error(),
|
* Tracer API. It contains convenience methods for info(), warn(), error(),
|
||||||
|
Loading…
Reference in New Issue
Block a user