OpenLayers OpenLayers

Changeset 276

Show
Ignore:
Timestamp:
05/23/06 10:45:51 (3 years ago)
Author:
crschmidt
Message:

Finishing Schuyler's commit the other day, which was designed to change behavior on release of shift key, but failed to actually do so...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Control/MouseDefaults.js

    r256 r276  
    5252        if (this.mouseDragStart != null) { 
    5353            if (this.zoomBox) { 
    54         /* after initially suggesting it, I'm not so sure  
    55          * this is a good idea ... 
    56          * I always let up off the shift key too early 
    57          * and cancel my zoombox by accident - SDE 
    58         if (!evt.shiftKey) { 
    59             this.defaultMouseUp(evt); 
    60                     return; 
    61                 } 
    62         */ 
    6354                var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x); 
    6455                var deltaY = Math.abs(this.mouseDragStart.y - evt.xy.y); 
     
    8980    defaultMouseUp: function (evt) { 
    9081        if (this.zoomBox) { 
    91         if (evt.shiftKey) { 
    92         var start = this.map.getLonLatFromPixel( this.mouseDragStart );  
    93         var end = this.map.getLonLatFromPixel( evt.xy ); 
    94         var top = Math.max(start.lat, end.lat); 
    95         var bottom = Math.min(start.lat, end.lat); 
    96         var left = Math.min(start.lon, end.lon); 
    97         var right = Math.max(start.lon, end.lon); 
    98         var bounds = new OpenLayers.Bounds(left, bottom, right, top); 
    99         var zoom = this.map.getZoomForExtent(bounds); 
    100         this.map.setCenter(new OpenLayers.LonLat( 
    101           (start.lon + end.lon) / 2, 
    102           (start.lat + end.lat) / 2 
    103          ), zoom); 
    104             } 
     82            var start = this.map.getLonLatFromPixel( this.mouseDragStart );  
     83            var end = this.map.getLonLatFromPixel( evt.xy ); 
     84            var top = Math.max(start.lat, end.lat); 
     85            var bottom = Math.min(start.lat, end.lat); 
     86            var left = Math.min(start.lon, end.lon); 
     87            var right = Math.max(start.lon, end.lon); 
     88            var bounds = new OpenLayers.Bounds(left, bottom, right, top); 
     89            var zoom = this.map.getZoomForExtent(bounds); 
     90            this.map.setCenter(new OpenLayers.LonLat( 
     91              (start.lon + end.lon) / 2, 
     92              (start.lat + end.lat) / 2 
     93             ), zoom); 
    10594            this.map.viewPortDiv.removeChild(document.getElementById("zoomBox")); 
    10695            this.zoomBox = null;