diff --git a/lib/OpenLayers/Control/ModifyFeature.js b/lib/OpenLayers/Control/ModifyFeature.js index efb71840ec..7c8a314a54 100644 --- a/lib/OpenLayers/Control/ModifyFeature.js +++ b/lib/OpenLayers/Control/ModifyFeature.js @@ -289,6 +289,8 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, { this.resetVertices(); this.dragControl.activate(); this.onModificationStart(this.feature); + this.layer.events.triggerEvent("beforefeaturemodified", + {feature: this.feature}); }, /** @@ -315,6 +317,8 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, { this.feature = null; this.dragControl.deactivate(); this.onModificationEnd(object.feature); + this.layer.events.triggerEvent("afterfeaturemodified", + {feature: object.feature}); }, /** @@ -428,6 +432,8 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, { dragComplete: function(vertex) { this.resetVertices(); this.onModification(this.feature); + this.layer.events.triggerEvent("featuremodified", + {feature: this.feature}); }, /** @@ -500,6 +506,8 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, { this.selectControl.renderIntent); this.resetVertices(); this.onModification(this.feature); + this.layer.events.triggerEvent("featuremodified", + {feature: this.feature}); } } }, diff --git a/lib/OpenLayers/Layer/Vector.js b/lib/OpenLayers/Layer/Vector.js index bb5c76ebfb..8ddc18d5c5 100644 --- a/lib/OpenLayers/Layer/Vector.js +++ b/lib/OpenLayers/Layer/Vector.js @@ -51,9 +51,19 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, { * - *featureunselected* Triggered after a feature is unselected. * Listeners will receive an object with a *feature* property * referencing the unselected feature. + * - *beforefeaturemodified* Triggered when a feature is selected to + * be modified. Listeners will receive an object with a *feature* + * property referencing the selected feature. + * - *featuremodified* Triggered when a feature has been modified. + * Listeners will receive an object with a *feature* property referencing + * the modified feature. + * - *afterfeaturemodified* Triggered when a feature is finished being modified. + * Listeners will receive an object with a *feature* property referencing + * the modified feature. */ EVENT_TYPES: ["beforefeatureadded", "featureadded", - "featuresadded", "featureselected", "featureunselected"], + "featuresadded", "featureselected", "featureunselected", + "beforefeaturemodified", "featuremodified", "afterfeaturemodified"], /** * APIProperty: isBaseLayer diff --git a/tests/Control/test_ModifyFeature.html b/tests/Control/test_ModifyFeature.html index 268ce26424..f6c4634f3f 100644 --- a/tests/Control/test_ModifyFeature.html +++ b/tests/Control/test_ModifyFeature.html @@ -3,12 +3,13 @@