Ticket #1288: fractional_panzoombar.patch
| File fractional_panzoombar.patch, 2.0 kB (added by crschmidt, 1 year ago) |
|---|
-
lib/OpenLayers/Control/PanZoomBar.js
old new 314 314 scope: this 315 315 }); 316 316 var deltaY = this.zoomStart.y - evt.xy.y; 317 this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight)); 317 if (this.map.fractionalZoom) { 318 var zoomLevel = this.map.zoom + (deltaY/this.zoomStopHeight); 319 zoomLevel = Math.min(Math.max(zoomLevel, 0), 320 this.map.getNumZoomLevels()); 321 var scale = OpenLayers.Util.getScaleFromResolution( 322 this.map.getResolutionForZoom(zoomLevel), this.map.units ); 323 this.map.zoomToScale(scale); 324 } else { 325 this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight)); 326 } 318 327 this.moveZoomBar(); 319 328 this.mouseDragStart = null; 320 329 OpenLayers.Event.stop(evt); -
examples/fractional-zoom.html
old new 13 13 var map; 14 14 15 15 function init() { 16 map = new OpenLayers.Map('map'); 16 map = new OpenLayers.Map('map', 17 {controls: [new OpenLayers.Control.Navigation(), 18 new OpenLayers.Control.PanZoomBar()], 19 numZoomLevels: 10 }); 17 20 var wms = new OpenLayers.Layer.WMS( 18 21 "OpenLayers WMS", 19 22 "http://labs.metacarta.com/wms/vmap0", … … 22 25 map.addLayers([wms]); 23 26 24 27 map.events.register("moveend", null, displayZoom); 25 map.addControl( new OpenLayers.Control.LayerSwitcher() );26 28 27 29 map.zoomToMaxExtent(); 28 30
