Changeset 2548
- Timestamp:
- 03/08/07 17:29:10 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/vector-2.4/lib/OpenLayers/Control/MouseDefaults.js
r2509 r2548 100 100 }, 101 101 102 zoomWithWheel: function (evt, direction) { 103 var mouse = this.map.getLonLatFromPixel(evt.xy); 104 var center = this.map.getCenter(); 105 var resolution = this.map.getResolution(); 106 var mouseToCenter = new OpenLayers.Pixel((mouse.lon - center.lon) / resolution, 107 (mouse.lat - center.lat) / resolution); 108 var nextZoom = this.map.getZoom() + direction; 109 var nextResolution = this.map.baseLayer.resolutions[nextZoom]; 110 this.map.setCenter( 111 new OpenLayers.LonLat(center.lon + (mouseToCenter.x * nextResolution), 112 center.lat + (mouseToCenter.y * nextResolution)), 113 nextZoom); 114 }, 115 102 116 /** User spun scroll wheel up 103 *104 117 */ 105 118 wheelUp: function(evt) { 106 this.map.setCenter(this.map.getLonLatFromPixel(evt.xy), 107 this.map.getZoom() + 1); 119 this.zoomWithWheel(+1); 108 120 }, 109 121 110 122 /** User spun scroll wheel down 111 *112 123 */ 113 124 wheelDown: function(evt) { 114 this.map.setCenter(this.map.getLonLatFromPixel(evt.xy), 115 this.map.getZoom() - 1); 125 this.zoomWithWheel(-1); 116 126 }, 117 127
