[OpenLayers-Users] Touch Navigation and Layer listener (click) - pixelTolerance
Frederick Löbig
frederick.loebig at live.de
Mon Apr 21 11:06:35 PDT 2014
Hey,
I have a problem regarding my touch-navigation map having a layerListener listening for clicks on a vector layer. The clicking is very tricky because I think the listener does not register an action as a click, when the finger is not completely still while touching the marker. I've heard of the property 'pixelTolerance' and added it to the listener to pass to the clickHandler, but it does not seem to work. Here is my code:
Map constructor:
map = new OpenLayers.Map('map', { layers: [layer, pointLayer, vector], controls: [ new OpenLayers.Control.TouchNavigation({ dragPanOptions: { enableKinetic: true }, clickHandlerOptions: { pixelTolerance: 10 } }), new OpenLayers.Control.Zoom(), new OpenLayers.Control.LayerSwitcher() ], zoom: 10, center: [-1081125, 6212801] });
Listener Constructor:
var layerListeners = { featureclick: function(e) { //log(e.object.name + " says: " + e.feature.id + " clicked."); //alert(e.feature.attributes.Name); ajax_request('mob_detail.php','POST','?t=1&id='+e.feature.attributes.Id,'mob_detailLayer'); return false; } };
Layer constructor:
pointLayer = new OpenLayers.Layer.Vector("Wasserhäuschen", { strategies: [new OpenLayers.Strategy.Fixed()], eventListeners: layerListeners, attribution:"© 2014 - <a href=http://www.linie11.org target=_blank>Linie 11 W.l.W. e.V.</a>", 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 : ""; } // .. }
})}); registerEvents(pointLayer);
Any ideas?
---
Frederick Löbig
Ingenieur für Geomatik und Geodäsie
Dienst:
Fachreferent bei DB Netz AG
Zentraler Datenmanager und Innovationsverantwortlicher
Infrastrukturdatenmanagement (I.NVT 52)
A: Im Galluspark 23, 60326 Frankfurt am Main
E: Frederick.Loebig at deutschebahn.com
Privat:
Röderichstraße 59
60489 Frankfurt am Main
---
E: Frederick.Loebig at live.de
P: +49 (0) 69 - 78 99 52 41
M: +49 (0) 174 - 70 89 296
S: floebig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140421/cd795ed4/attachment.html>
More information about the Users
mailing list