Skip to content

Added the "index" property to the "vertexremoved" event. #1409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/OpenLayers/Control/ModifyFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -666,15 +666,16 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
if(this.feature &&
OpenLayers.Util.indexOf(this.deleteCodes, code) != -1) {
var vertex = this._lastVertex;
if (vertex &&
OpenLayers.Util.indexOf(this.vertices, vertex) != -1 &&
var index = OpenLayers.Util.indexOf(this.vertices, vertex);
if (vertex && index != -1 &&
!this.handlers.drag.dragging && vertex.geometry.parent) {
// remove the vertex
vertex.geometry.parent.removeComponent(vertex.geometry);
this.layer.events.triggerEvent("vertexremoved", {
vertex: vertex.geometry,
feature: this.feature,
pixel: evt.xy
pixel: evt.xy,
index: index
});
this.layer.drawFeature(this.feature, this.standalone ?
undefined : 'select');
Expand Down
6 changes: 4 additions & 2 deletions lib/OpenLayers/Layer/Vector.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
* has been deleted. Listeners will receive an object with a
* *feature* property referencing the modified feature, a *vertex*
* property referencing the vertex modified (always a point geometry),
* and a *pixel* property referencing the pixel location of the
* removal.
* a *pixel* property referencing the pixel location of the
* removal, and an *index* property referencing the index in the
* parent component that the point geometry occupied prior to being
* removed.
* sketchstarted - Triggered when a feature sketch bound for this layer
* is started. Listeners will receive an object with a *feature*
* property referencing the new sketch feature and a *vertex* property
Expand Down