Reuse featuresBeingModified_ collection
This commit is contained in:
@@ -253,7 +253,7 @@ class Modify extends PointerInteraction {
|
|||||||
this.ignoreNextSingleClick_ = false;
|
this.ignoreNextSingleClick_ = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Array<Feature>}
|
* @type {Collection<Feature>}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.featuresBeingModified_ = null;
|
this.featuresBeingModified_ = null;
|
||||||
@@ -414,12 +414,12 @@ class Modify extends PointerInteraction {
|
|||||||
*/
|
*/
|
||||||
willModifyFeatures_(evt, segments) {
|
willModifyFeatures_(evt, segments) {
|
||||||
if (!this.featuresBeingModified_) {
|
if (!this.featuresBeingModified_) {
|
||||||
this.featuresBeingModified_ = [];
|
this.featuresBeingModified_ = new Collection();
|
||||||
const features = this.featuresBeingModified_;
|
const features = this.featuresBeingModified_.getArray();
|
||||||
for (let i = 0, ii = segments.length; i < ii; ++i) {
|
for (let i = 0, ii = segments.length; i < ii; ++i) {
|
||||||
const feature = segments[i][0].feature;
|
const feature = segments[i][0].feature;
|
||||||
if (features.indexOf(feature) === -1) {
|
if (features.indexOf(feature) === -1) {
|
||||||
features.push(feature);
|
this.featuresBeingModified_.push(feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1079,7 +1079,7 @@ class Modify extends PointerInteraction {
|
|||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new ModifyEvent(
|
new ModifyEvent(
|
||||||
ModifyEventType.MODIFYEND,
|
ModifyEventType.MODIFYEND,
|
||||||
new Collection(this.featuresBeingModified_),
|
this.featuresBeingModified_,
|
||||||
evt
|
evt
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -1302,7 +1302,7 @@ class Modify extends PointerInteraction {
|
|||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new ModifyEvent(
|
new ModifyEvent(
|
||||||
ModifyEventType.MODIFYEND,
|
ModifyEventType.MODIFYEND,
|
||||||
new Collection(this.featuresBeingModified_),
|
this.featuresBeingModified_,
|
||||||
evt
|
evt
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user