Changeset 6799
- Timestamp:
- 04/07/08 00:08:33 (5 months ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js (modified) (1 diff)
- trunk/openlayers/tests/Control/PanZoomBar.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js
r6516 r6799 243 243 var top = OpenLayers.Util.pagePosition(evt.object)[1]; 244 244 var levels = (y - top)/this.zoomStopHeight; 245 if(!this.map.fractionalZoom) { 246 levels = Math.floor(levels); 247 } 245 248 var zoom = (this.map.getNumZoomLevels() - 1) - levels; 246 if(this.map.fractionalZoom) { 247 zoom = Math.min(Math.max(zoom, 0), this.map.getNumZoomLevels() - 1); 248 } else { 249 zoom = Math.floor(zoom); 250 } 249 zoom = Math.min(Math.max(zoom, 0), this.map.getNumZoomLevels() - 1); 251 250 this.map.zoomTo(zoom); 252 251 OpenLayers.Event.stop(evt); trunk/openlayers/tests/Control/PanZoomBar.html
r6724 r6799 34 34 t.eq( control2.div.style.top, "100px", "2nd control div is located correctly"); 35 35 } 36 function test_Control_PanZoomBar_divClick (t) { 37 t.plan(2); 38 map = new OpenLayers.Map('map', {controls:[]}); 39 var layer = new OpenLayers.Layer.WMS("Test Layer", 40 "http://octo.metacarta.com/cgi-bin/mapserv?", 41 {map: "/mapdata/vmap_wms.map", layers: "basic"}); 42 map.addLayer(layer); 43 control = new OpenLayers.Control.PanZoomBar(); 44 map.addControl(control); 45 control.divClick({'xy': {'x': 0, 'y': 50}, which: 1}); 46 t.eq(map.zoom, 11, "zoom is correct on standard map"); 47 48 map.fractionalZoom = true; 49 control.divClick({'xy': {'x': 0, 'y': 49}, which: 1}); 50 t.eq(map.zoom.toFixed(3), '10.545', "zoom is correct on fractional zoom map"); 51 52 } 36 53 37 54 </script>
