Skip to content

Error when try to move vertex of a multi features in direct_select mode. #1442

@IMehlhoffer

Description

@IMehlhoffer

The cause of the error is that during the drag operation MultiFeature calls the takeAction function for every element in its feature array:

MultiFeature.prototype.updateCoordinate = function(path, lng, lat) {
takeAction(this.features, 'updateCoordinate', path, lng, lat);
this.changed();
};

These elements in the feature array are not directly included in the main Source. Therefore MultiFeature calls updateCoordinate of all internal features, and these will call the Store.featureChanged method with an featureId parameter that is not in Store of context of MapboxDraw.

Polygon.prototype.updateCoordinate = function(path, lng, lat) {
this.changed();
...
}

This causes that bad id entered into the _changedFeatureIds object, and then the

this.get(featureId).toGeoJSON()

throws error becuse get method returns undefined.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions