Patch for ModifyFeature control of OpenLayers.
Extends the ModifyFeature control behavior to allow delete by del-key the feature that have been selected for modification.
OpenLayers. | Patch for ModifyFeature control of OpenLayers. |
Properties | |
onMap | {Boolean} Read only, true if the cursor is on the map. |
mapListeners | {Object} Internal use. |
events | {<OpenLayers.Events>} Events instance for listeners and triggering control specific events. |
featureDelkeyMode | {String} Mode in which the del-key acts to remove the feature that is selected for modification. |
deferDelete | {Boolean} Instead of removing features from the layer, set feature states of deleted features to DELETE. |
escapeCode | {Integer} Keycode for cancel a vertex drag. |
initialVertex | {Object} Internal use |
Functions | |
handleKeypress | Called by the feature handler on keypress. |
dragStart | Called by the drag feature control with before a feature is dragged. |
justUnselectFeature | Called to unselect the feature. |
{<OpenLayers.Events>} Events instance for listeners and triggering control specific events.
beforefeaturedeleted | Triggered before a feature is deleted. Listeners will receive an object with a feature property referencing the feature to be deleted, to stop delete listener should return false. |
featuredeleted | Triggerd after a feature is deleted. The event object passed to listeners will have a feature property with a reference to the deleted feature, if deferDelete is true and the state of the feature is not INSERT, the estate is set as DELETE but still retains in the layer, otherwise layer is null and the feature will be destroyed after this enent. |
{String} Mode in which the del-key acts to remove the feature that is selected for modification. The available modes are: “none”, “always”, “bounds” (only be deleted if when pressing del-key the mouse is within the feature bounds) and “hover” (only be deleted pressing del-key when the mouse is placed over the feature) If the cursor is outside the map the feature are not deleted. Default is “always”.
{Boolean} Instead of removing features from the layer, set feature states of deleted features to DELETE. This assumes a save strategy or other component is in charge of removing features from the layer. Default is false. If false, deleted features will be immediately removed from the layer.
_prototype.handleKeypress = function( evt )
Called by the feature handler on keypress. This is used to delete vertices and features. If the <deleteCode> property is set, vertices will be deleted when a feature is selected for modification and the mouse is over a vertex, otherwise the feature will be depending of featureDelkeyMode
evt | {Event} Keypress event. |
_prototype.dragStart = function( feature, pixel )
Called by the drag feature control with before a feature is dragged. This method is used to differentiate between points and vertices of higher order geometries. This respects the <geometryTypes> property and forces a select of points when the drag control is already active (and stops events from propagating to the select control).
feature | {<OpenLayers.Feature.Vector>} The point or vertex about to be dragged. |
pixel | {<OpenLayers.Pixel>} Pixel location of the mouse event. |
Called by the feature handler on keypress.
_prototype.handleKeypress = function( evt )
Called by the drag feature control with before a feature is dragged.
_prototype.dragStart = function( feature, pixel )
Called to unselect the feature.
_prototype.justUnselectFeature = function( feature )