don't render when hidden

This commit is contained in:
javi 2013-10-31 13:14:56 +01:00
parent f08fe5bc48
commit 79becc8ae1
2 changed files with 9 additions and 0 deletions

View File

@ -86,14 +86,18 @@ GMapsTorqueLayer.prototype = _.extend({},
},
hide: function() {
if(this.hidden) return this;
this.pause();
this.clear();
this.hidden = true;
return this;
},
show: function() {
if(!this.hidden) return this;
this.hidden = false;
this.play();
return this;
},
setSQL: function(sql) {

View File

@ -71,14 +71,18 @@ L.TorqueLayer = L.CanvasLayer.extend({
},
hide: function() {
if(this.hidden) return this;
this.pause();
this.clear();
this.hidden = true;
return this;
},
show: function() {
if(!this.hidden) return this;
this.hidden = false;
this.play();
return this;
},
setSQL: function(sql) {
@ -121,6 +125,7 @@ L.TorqueLayer = L.CanvasLayer.extend({
* requestAnimationFrame. Use redraw to refresh it
*/
render: function() {
if(this.hidden) return;
var t, tile, pos;
var canvas = this.getCanvas();
canvas.width = canvas.width;