You can override the Click class by the following:

Put this somewhere outside your other functions:

OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {

        defaultHandlerOptions: {
                'single': true,
                'double': true,
                'pixelTolerance': 0,
                'stopSingle': false,
                'stopDouble': true
        },

        initialize: function(options) {
                this.handlerOptions = OpenLayers.Util.extend(
                        {}, this.defaultHandlerOptions
                );
                OpenLayers.Control.prototype.initialize.apply(
                        this, arguments
                ); 
                this.handler = new OpenLayers.Handler.Click(
                        this, {
                                'click': this.onClick,
                                'dblclick': this.onDblclick 
                        }, this.handlerOptions
                );
        },
        onClick: function(event) {
                alert("single click");
        },
        onDblclick: function(event) {  
                alert("double click");
        }   
});


You'll also need to add this control and activate it:

var clickControl = new OpenLayers.Control.Click();
map.addControl(clickControl);
clickControl.activate();

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of proveo
Sent: Tuesday, October 11, 2011 10:50 AM
To: [email protected]
Subject: [OpenLayers-Users] Open Popup with DoubleClick

Hallo,

how can I realise that the SelectFeature Control reacts on "onSelect:
selectFeature" only with a doubleClick, but on "onUnselect:
unselectFeature"
with a normal click.

e.g. opening a popup on a VectorLayer with doubleClick and Closing the
Popup with one Click on the Map.

Perhaps I can use this: new OpenLayers.Control.Click({
                    handlerOptions: {
                        "single": false,
                        "double": true
                    }
                })

but i have no idea how to combine this with the SelectControl.

Greetings

--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Open-Popup-with-DoubleClick-tp688
1265p6881265.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to