The easiest to achieve this is to register for the map's zoomend event: function notice() { var bounds = map.getExtent(); /* your existing notice code here */ } map.events.register("zoomend", this, notice);
Andreas. On Tue, Oct 9, 2012 at 12:25 AM, Bessette-Halsema, Dominique E <dominique.besse...@gdit.com> wrote: > Hi > > I'm having issues creating handlers for my mobile touch map. Using > TouchNavigation I'm able to Pan and PinchZoom but I need the resulting > bounding box from the map. If you look at the old Non-mobile code below I > need to be able to call the notice function when the user is done panning and > zooming. Is there a way I can do this? > > TouchNavigation code > > private static native void createBoxControl(MapView scope, boolean > activateBoxCtrl) /*-{ > $wnd.boxControl = new $wnd.OpenLayers.Control.TouchNavigation({ > dragPanOptions: { > interval: 0, // non-zero kills performance on some mobile > phones > enableKinetic: true > } > }) > > > }-*/; > > > > Old Non-Mobile code > > private static native void createBoxControl(MapView scope, boolean > activateBoxCtrl) /*-{ > $wnd.boxControl = new $wnd.OpenLayers.Control(); > $wnd.OpenLayers.Util.extend($wnd.boxControl, { > draw: function() { > this.handler = new > $wnd.OpenLayers.Handler.Box($wnd.boxControl, > {"done": this.notice}, > {keyMask: $wnd.OpenLayers.Handler.MOD_SHIFT}); > if(activateBoxCtrl) { > this.activate(); > } > }, > > notice: function(bounds) { > var leftBottomPx = new $wnd.OpenLayers.Pixel(bounds.left, > bounds.bottom); > var rightTopPx = new $wnd.OpenLayers.Pixel(bounds.right, > bounds.top); > var leftBottomLonLat = > $wnd.map.getLonLatFromViewPortPx(leftBottomPx); > var rightTopLonLat = > $wnd.map.getLonLatFromViewPortPx(rightTopPx); > > sco...@mil.navy.fnmoc.gis.mapss.selection.client.MapView::updateCorners(DDDD)( > leftBottomLonLat.lon, leftBottomLonLat.lat, > rightTopLonLat.lon, rightTopLonLat.lat); > } > }); > }-*/; > _______________________________________________ > Dev mailing list > d...@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/openlayers-dev -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. _______________________________________________ Dev mailing list d...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-dev