Use a unique key for all tile classes
This commit is contained in:
+2
-7
@@ -39,6 +39,8 @@ class ImageTile extends Tile {
|
|||||||
*/
|
*/
|
||||||
this.src_ = src;
|
this.src_ = src;
|
||||||
|
|
||||||
|
this.key = src;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {HTMLImageElement|HTMLCanvasElement}
|
* @type {HTMLImageElement|HTMLCanvasElement}
|
||||||
@@ -70,13 +72,6 @@ class ImageTile extends Tile {
|
|||||||
return this.image_;
|
return this.image_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {string} Key.
|
|
||||||
*/
|
|
||||||
getKey() {
|
|
||||||
return this.src_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tracks loading or read errors.
|
* Tracks loading or read errors.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ class VectorTile extends Tile {
|
|||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
this.url_ = src;
|
this.url_ = src;
|
||||||
|
|
||||||
|
this.key = src;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,13 +85,6 @@ class VectorTile extends Tile {
|
|||||||
return this.features_;
|
return this.features_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {string} Key.
|
|
||||||
*/
|
|
||||||
getKey() {
|
|
||||||
return this.url_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load not yet loaded URI.
|
* Load not yet loaded URI.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ describe('ol.source.VectorTile', function () {
|
|||||||
);
|
);
|
||||||
if (sourceTiles) {
|
if (sourceTiles) {
|
||||||
expect(sourceTiles[0].getKey()).to.be(
|
expect(sourceTiles[0].getKey()).to.be(
|
||||||
'spec/ol/data/14-8938-5680.vector.pbf?new'
|
'spec/ol/data/14-8938-5680.vector.pbf?new/14,8938,5680'
|
||||||
);
|
);
|
||||||
unByKey(key);
|
unByKey(key);
|
||||||
done();
|
done();
|
||||||
|
|||||||
Reference in New Issue
Block a user