[OpenLayers-Users] Is it possible to delete a point using theModifyFeature control?

Oscar Fonts oscar.fonts.lists at gmail.com
Tue May 27 02:53:06 EDT 2008


2008/5/19 Tim Schaub <tschaub at opengeo.org>:

> Arnd Wippermann wrote:
> > I would appreciate, if the Control.ModifyFeature would enhanced to delete
> > features.
>
> This was originally the intent.  Chris suggested it would be too easy to
> delete a feature accidentally when you were trying to hover over a
> vertex.  Providing an option on the control seems like a sensible solution.
>


You could show a confirm dialog:

    handleKeypress: function(code) {
        // check for delete key
        if(this.feature && OpenLayers.Util.indexOf(this.deleteCodes, code)
!= -1) {
            var vertex = this.dragControl.feature;
            if(vertex && [..]) {
                // ...
            } else { // Not over a vertex
                if(confirm("Do you want to delete the selected feature?")){
                    var f = this.feature;
                    this.unselectFeature(this);
                    this.layer.removeFeatures([f]);
                }
            }
        }
    },

Oscar.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080527/535592ae/attachment.html


More information about the Users mailing list