Adds key property to torque layers to keep property publicaly exposed
This commit is contained in:
parent
2d5542a28c
commit
d478fdc1b0
@ -10,6 +10,11 @@ function GMapsTorqueLayer(options) {
|
||||
throw new Error("browser is not supported by torque");
|
||||
}
|
||||
this.keys = [0];
|
||||
Object.defineProperty(this, 'key', {
|
||||
get: function() {
|
||||
return this.getKey();
|
||||
}
|
||||
});
|
||||
this.shader = null;
|
||||
this.ready = false;
|
||||
this.options = torque.extend({}, options);
|
||||
|
@ -27,6 +27,11 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
}
|
||||
options.tileLoader = true;
|
||||
this.keys = [0];
|
||||
Object.defineProperty(this, 'key', {
|
||||
get: function() {
|
||||
return this.getKey();
|
||||
}
|
||||
});
|
||||
this.prevRenderedKey = 0;
|
||||
if (options.cartocss) {
|
||||
torque.extend(options, torque.common.TorqueLayer.optionsFromCartoCSS(options.cartocss));
|
||||
|
9
test/leaflet/torque-layer.js
Normal file
9
test/leaflet/torque-layer.js
Normal file
@ -0,0 +1,9 @@
|
||||
var torque = require('../../lib/torque/index');
|
||||
|
||||
QUnit.module('leaflet-torque-layer');
|
||||
|
||||
test('exposes key property', function(assert) {
|
||||
var torqueLayer = new L.TorqueLayer({});
|
||||
assert.equal(torqueLayer.key, 0);
|
||||
assert.equal(torqueLayer.getKey(), torqueLayer.key);
|
||||
});
|
@ -1,6 +1,7 @@
|
||||
require('qunitjs');
|
||||
|
||||
require('./core');
|
||||
require('./leaflet/torque-layer');
|
||||
require('./torque');
|
||||
require('./renderer/point');
|
||||
require('./provider.jsonarray');
|
||||
|
Loading…
Reference in New Issue
Block a user