Hello there, I am trying to use custom control to draw a rectangular box and get the dimension after drawing a box on the map. My problem is I want to retain the box on mouse up instead of the box disappearing. Right now, it displays the alert box when I mouse up.
Here is what I am doing now: <code> var control = new OpenLayers.Control(); OpenLayers.Util.extend(control, { draw: function () { // this Handler.Box will intercept the shift-mousedown // before Control.MouseDefault gets to see it this.box = new OpenLayers.Handler.Box( control, {"done": this.notice}, {keyMask: OpenLayers.Handler.MOD_SHIFT}); this.box.activate(); }, notice: function (bounds) { var ll = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.left, bounds.bottom)); var ur = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.right, bounds.top)); alert(ll.lon.toFixed(4) + ", " + ll.lat.toFixed(4) + ", " + ur.lon.toFixed(4) + ", " + ur.lat.toFixed(4)); } }); map.addControl(control); </code> What I need is when I press shift key I should be able to draw a box on the map and then resize it if required and then click a button to get the dimensions(alert box). I appreciate any help, Thanks a lot! Moiz
_______________________________________________ Dev mailing list Dev@openlayers.org http://openlayers.org/mailman/listinfo/dev