Change getUid return type from number to string

This commit is contained in:
Frederic Junod
2018-10-17 08:58:50 +02:00
parent a85099a36b
commit 041836c645
33 changed files with 78 additions and 92 deletions
+2 -2
View File
@@ -788,7 +788,7 @@ class Modify extends PointerInteraction {
for (let i = 0, ii = segmentDataMatches.length; i < ii; ++i) {
const segmentDataMatch = segmentDataMatches[i];
const segment = segmentDataMatch.segment;
let uid = String(getUid(segmentDataMatch.feature));
let uid = getUid(segmentDataMatch.feature);
const depth = segmentDataMatch.depth;
if (depth) {
uid += '-' + depth.join('-'); // separate feature components
@@ -1038,7 +1038,7 @@ class Modify extends PointerInteraction {
for (i = dragSegments.length - 1; i >= 0; --i) {
dragSegment = dragSegments[i];
segmentData = dragSegment[0];
uid = String(getUid(segmentData.feature));
uid = getUid(segmentData.feature);
if (segmentData.depth) {
// separate feature components
uid += '-' + segmentData.depth.join('-');
+4 -7
View File
@@ -250,7 +250,7 @@ class Select extends Interaction {
* An association between selected feature (key)
* and layer (value)
* @private
* @type {Object<number, import("../layer/Layer.js").default>}
* @type {Object<string, import("../layer/Layer.js").default>}
*/
this.featureLayerAssociation_ = {};
@@ -267,8 +267,7 @@ class Select extends Interaction {
* @private
*/
addFeatureLayerAssociation_(feature, layer) {
const key = getUid(feature);
this.featureLayerAssociation_[key] = layer;
this.featureLayerAssociation_[getUid(feature)] = layer;
}
/**
@@ -299,9 +298,8 @@ class Select extends Interaction {
* @api
*/
getLayer(feature) {
const key = getUid(feature);
return (
/** @type {VectorLayer} */ (this.featureLayerAssociation_[key])
/** @type {VectorLayer} */ (this.featureLayerAssociation_[getUid(feature)])
);
}
@@ -372,8 +370,7 @@ class Select extends Interaction {
* @private
*/
removeFeatureLayerAssociation_(feature) {
const key = getUid(feature);
delete this.featureLayerAssociation_[key];
delete this.featureLayerAssociation_[getUid(feature)];
}
}
+3 -3
View File
@@ -127,7 +127,7 @@ class Snap extends PointerInteraction {
this.featuresListenerKeys_ = [];
/**
* @type {Object<number, import("../events.js").EventsKey>}
* @type {Object<string, import("../events.js").EventsKey>}
* @private
*/
this.featureChangeListenerKeys_ = {};
@@ -135,7 +135,7 @@ class Snap extends PointerInteraction {
/**
* Extents are preserved so indexed segment can be quickly removed
* when its feature geometry changes
* @type {Object<number, import("../extent.js").Extent>}
* @type {Object<string, import("../extent.js").Extent>}
* @private
*/
this.indexedFeaturesExtents_ = {};
@@ -144,7 +144,7 @@ class Snap extends PointerInteraction {
* If a feature geometry changes while a pointer drag|move event occurs, the
* feature doesn't get updated right away. It will be at the next 'pointerup'
* event fired.
* @type {!Object<number, import("../Feature.js").default>}
* @type {!Object<string, import("../Feature.js").default>}
* @private
*/
this.pendingFeatures_ = {};