added setters

This commit is contained in:
javi 2013-10-10 18:16:31 +02:00
parent 2655094cdc
commit 38210c693e
3 changed files with 21 additions and 1 deletions

View File

@ -26,6 +26,7 @@ function GMapsTorqueLayer(options) {
this.stop = this.animator.stop.bind(this.animator); this.stop = this.animator.stop.bind(this.animator);
this.pause = this.animator.pause.bind(this.animator); this.pause = this.animator.pause.bind(this.animator);
this.toggle = this.animator.toggle.bind(this.animator); this.toggle = this.animator.toggle.bind(this.animator);
this.setDuration = this.animator.duration.bind(this.animator);
CanvasLayer.call(this, { CanvasLayer.call(this, {
@ -80,6 +81,11 @@ GMapsTorqueLayer.prototype = _.extend({},
}, },
setSteps: function(steps) {
this.provider.setSteps(steps);
this._reloadTiles();
},
getCanvas: function() { getCanvas: function() {
return this.canvas; return this.canvas;
}, },

View File

@ -33,8 +33,8 @@ L.TorqueLayer = L.CanvasLayer.extend({
this.stop = this.animator.stop.bind(this.animator); this.stop = this.animator.stop.bind(this.animator);
this.pause = this.animator.pause.bind(this.animator); this.pause = this.animator.pause.bind(this.animator);
this.toggle = this.animator.toggle.bind(this.animator); this.toggle = this.animator.toggle.bind(this.animator);
this.setDuration = this.animator.duration.bind(this.animator);
this.setBlendMode = this.renderer.setBlendMode.bind(this.renderer);
L.CanvasLayer.prototype.initialize.call(this, options); L.CanvasLayer.prototype.initialize.call(this, options);
@ -44,6 +44,8 @@ L.TorqueLayer = L.CanvasLayer.extend({
this.provider = new this.providers[this.options.provider](options); this.provider = new this.providers[this.options.provider](options);
this.renderer = new this.renderers[this.options.renderer](this.getCanvas(), options); this.renderer = new this.renderers[this.options.renderer](this.getCanvas(), options);
this.setBlendMode = this.renderer.setBlendMode.bind(this.renderer);
// for each tile shown on the map request the data // for each tile shown on the map request the data
this.on('tileAdded', function(t) { this.on('tileAdded', function(t) {
var tileData = this.provider.getTileData(t, t.zoom, function(tileData) { var tileData = this.provider.getTileData(t, t.zoom, function(tileData) {
@ -53,6 +55,11 @@ L.TorqueLayer = L.CanvasLayer.extend({
}, this); }, this);
}, },
setSteps: function(steps) {
this.provider.setSteps(steps);
this._reloadTiles();
},
/** /**
* render the selectef key * render the selectef key
* don't call this function directly, it's called by * don't call this function directly, it's called by

View File

@ -224,6 +224,13 @@
}; };
}, },
setSteps: function(steps) {
if (this.options.steps !== steps) {
this.options.steps = steps;
this.options.step = (this.options.end- this.options.start)/this.options.steps;
}
},
getBounds: function() { getBounds: function() {
return this.options.bounds; return this.options.bounds;
}, },