fix: set pendingFeatures_ as object on init
This commit is contained in:
@@ -94,6 +94,15 @@ ol.interaction.Snap = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.indexedFeaturesExtents_ = {};
|
this.indexedFeaturesExtents_ = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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, ol.Feature>}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this.pendingFeatures_ = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for distance sorting in sortByDistance_
|
* Used for distance sorting in sortByDistance_
|
||||||
* @type {ol.Coordinate}
|
* @type {ol.Coordinate}
|
||||||
@@ -174,16 +183,6 @@ goog.exportProperty(
|
|||||||
ol.interaction.Snap.prototype.addFeature);
|
ol.interaction.Snap.prototype.addFeature);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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, ol.Feature>}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
ol.interaction.Snap.prototype.pendingFeatures_ = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.Feature} feature Feature.
|
* @param {ol.Feature} feature Feature.
|
||||||
* @private
|
* @private
|
||||||
@@ -602,9 +601,11 @@ ol.interaction.Snap.handleEvent_ = function(evt) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.interaction.Snap.handleUpEvent_ = function(evt) {
|
ol.interaction.Snap.handleUpEvent_ = function(evt) {
|
||||||
goog.array.forEach(goog.object.getValues(this.pendingFeatures_),
|
var featuresToUpdate = goog.object.getValues(this.pendingFeatures_);
|
||||||
this.updateFeature_, this);
|
if (featuresToUpdate.length) {
|
||||||
this.pendingFeatures_ = {};
|
goog.array.forEach(featuresToUpdate, this.updateFeature_, this);
|
||||||
|
this.pendingFeatures_ = {};
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user