[OpenLayers-Users] Pinch-Zoom / Drag while having an active clickControl

floebig frederick.loebig at live.de
Wed Apr 16 04:47:58 PDT 2014


Alright, thanks for the hint to use a listener instead.

I have added this to the init() function:

-----------------------------------------------

...

	// Create Event Listener

			var layerListeners = {
				featureclick: function(e) {
					//log(e.object.name + " says: " + e.feature.id + " clicked.");
					alert("DEBUG: clicked");
					return false;
				},
				nofeatureclick: function(e) {
					//log(e.object.name + " says: No feature clicked.");
					alert("DEBUG: no f clicked");
				}
			};
			
...

	// Create Layer

            pointLayer = new OpenLayers.Layer.Vector("Wasserhäuschen", {
            strategies: [new OpenLayers.Strategy.Fixed()],
			eventListeners: layerListeners
            attribution:"© 2014 -  Linie 11 W.l.W. e.V.
<http://www.linie11.org>  ",
            protocol: new OpenLayers.Protocol.HTTP({
                url: "./geoData/data.xml.gml",
                format: new OpenLayers.Format.GML()
            }),
			styleMap: new OpenLayers.StyleMap({'default':defaultStyle,
                                                          
'select':selectStyle,
                                                          
'temporary':tempStyle
											},{
                context: {
                  // ...
                  label: function(feature) {
                    // clustered features count or blank if feature is not a
cluster
                    return feature.cluster ? feature.cluster.length : "";  
                  }
                  // ..
                }

			})});

...

	// Create Map

            map = new OpenLayers.Map('map', {
				
                layers: [layer, pointLayer, vector],
				controls: [
            new OpenLayers.Control.TouchNavigation({
                dragPanOptions: {
                    enableKinetic: true
                }
            }),
            new OpenLayers.Control.Zoom()
        ],
                zoom: 10,
                center: [-1081125, 6212801]
            });
			
...

-----------------------------------------------

I have also quoted out the activation of the previous selectFeature(). But:
It does not seem to work. For debugging reasons it should pop up an alert
windows, but nothing seems to happen. The only message I receive in the
Javascript console is:

event.returnValue is deprecated. Please use the standard
event.preventDefault() instead. >> OpenLayers.mobile.js:64

Fyi, I am using ./OpenLayers-2.13.1/OpenLayers.mobile.js. 

What am I missing?




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Pinch-Zoom-Drag-while-having-an-active-clickControl-tp5134932p5135363.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list