Take the 2-minute tour ×

I have a function that i want to call when you start pinchzoom on the map. This function turns off all vector layers to improve performance while panning zooming. I got another function that is called with "moveend" which turns the vector layers back on after zoom pan finishes. I have both these functions already written.

I registered "movestart" and "zoomproxy" hack to trigger the layers to be turned off as soon as user starts panning or zooming. Everything works except on a mobile device where pinch zoom does not turn off the vector layers. it does not seem to call my function.

I know there is a pinch handler that could possibly be added onto a control and attached to the map. Could you please provide some details on how to do do this and in turn call my function to turn off layers at the start of pinch zoom.

Much appreciated.


share|improve this question
map.events.registerPriority you can manage priority of events example: bitbucket.org/robertodealmeida/jsdap/src/… –  Mapperz Aug 15 '13 at 3:55
Thanks. I got start of PinchZoom working using the following –  Rahul Aug 16 '13 at 10:57
map.events.register("touchstart", map, function({hideLayersBeforePanOrZoom();}); –  Rahul Aug 16 '13 at 11:02

1 Answer 1

The following worked for me.


I need to solve one more problem related to this however. PinchEnd. I want to be able to use a event listener for PinchEnd and call a function to display a dialog box indicating "Processing.Please wait". The function is ready and working. I tried to add the following code below but it does not work completely. Its an event handler rather than an event listener.

I want my function to fire but the system should continue the normal PinchEnd event handling. Looks like my function fires but it does not return the control back and finish whatever it is supposed to do for the PinchDone event. Can you please suggest how to register this as an event listener rather than an event handler. This is the last issue I need to resolve in order to complete my prototype for a demo. Any help would be much appreciated. Thanking You

map.addControl( new OpenLayers.Control.PinchZoom({pinchDone: function( evt, pinchData ){showProcessingIndicator();}}));

share|improve this answer

Your Answer


