Select to view content in your preferred language

How to execute a rubberBandZoom without pressing SHIFT?

547
1
05-03-2012 07:18 AM
YohanBienvenue
Frequent Contributor
I've added a button to my webapp that enables me to toggle on or off the rubberBandZoom of my map.
However I don't want to have the user press SHIFT first, this webapp will be for a mobile device (tablet)

Is that possible?

Thanks
0 Kudos
1 Reply
YohanBienvenue
Frequent Contributor
I tried fooling the API by capturing the MouseEvent and setting the shiftKey to true, but unfortunately this is not possible for security reasons. Some event properties (e.g. currentTarget) are protected from change.

MapPage.prototype.onMapMouseEvent = function(evt){ 
    
   evt.preventDefault();
   
   var e = jQuery.extend(true, {}, evt);
   e.shiftKey = true;
   e = new MouseEvent(evt.type, e);
   
   dojo.byId("mapDiv").dispatchEvent(e);
};


So I'll forget about this, I think I'll implement my own zoom box.
0 Kudos