Finishing Schuyler's commit the other day, which was designed to change behavior on release of shift key, but failed to actually do so...
git-svn-id: http://svn.openlayers.org/trunk/openlayers@276 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -51,15 +51,6 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
defaultMouseMove: function (evt) {
|
||||
if (this.mouseDragStart != null) {
|
||||
if (this.zoomBox) {
|
||||
/* after initially suggesting it, I'm not so sure
|
||||
* this is a good idea ...
|
||||
* I always let up off the shift key too early
|
||||
* and cancel my zoombox by accident - SDE
|
||||
if (!evt.shiftKey) {
|
||||
this.defaultMouseUp(evt);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x);
|
||||
var deltaY = Math.abs(this.mouseDragStart.y - evt.xy.y);
|
||||
this.zoomBox.style.width = deltaX+"px";
|
||||
@@ -88,20 +79,18 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
*/
|
||||
defaultMouseUp: function (evt) {
|
||||
if (this.zoomBox) {
|
||||
if (evt.shiftKey) {
|
||||
var start = this.map.getLonLatFromPixel( this.mouseDragStart );
|
||||
var end = this.map.getLonLatFromPixel( evt.xy );
|
||||
var top = Math.max(start.lat, end.lat);
|
||||
var bottom = Math.min(start.lat, end.lat);
|
||||
var left = Math.min(start.lon, end.lon);
|
||||
var right = Math.max(start.lon, end.lon);
|
||||
var bounds = new OpenLayers.Bounds(left, bottom, right, top);
|
||||
var zoom = this.map.getZoomForExtent(bounds);
|
||||
this.map.setCenter(new OpenLayers.LonLat(
|
||||
(start.lon + end.lon) / 2,
|
||||
(start.lat + end.lat) / 2
|
||||
), zoom);
|
||||
}
|
||||
var start = this.map.getLonLatFromPixel( this.mouseDragStart );
|
||||
var end = this.map.getLonLatFromPixel( evt.xy );
|
||||
var top = Math.max(start.lat, end.lat);
|
||||
var bottom = Math.min(start.lat, end.lat);
|
||||
var left = Math.min(start.lon, end.lon);
|
||||
var right = Math.max(start.lon, end.lon);
|
||||
var bounds = new OpenLayers.Bounds(left, bottom, right, top);
|
||||
var zoom = this.map.getZoomForExtent(bounds);
|
||||
this.map.setCenter(new OpenLayers.LonLat(
|
||||
(start.lon + end.lon) / 2,
|
||||
(start.lat + end.lat) / 2
|
||||
), zoom);
|
||||
this.map.viewPortDiv.removeChild(document.getElementById("zoomBox"));
|
||||
this.zoomBox = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user