OpenLayers OpenLayers

Changeset 6799

Show
Ignore:
Timestamp:
04/07/08 00:08:33 (5 months ago)
Author:
crschmidt
Message:

2.6 accidentally broke behavior when clicking on the panzoombar. Thanks to Linda Rawson's report of this issue, this is now fixed, by moving the Math.floor call to a different part of the code. r=euzuro (Pullup #1486)

Files:

Legend:

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

    r6516 r6799  
    243243        var top = OpenLayers.Util.pagePosition(evt.object)[1]; 
    244244        var levels = (y - top)/this.zoomStopHeight; 
     245        if(!this.map.fractionalZoom) { 
     246            levels = Math.floor(levels); 
     247        }     
    245248        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); 
    251250        this.map.zoomTo(zoom); 
    252251        OpenLayers.Event.stop(evt); 
  • trunk/openlayers/tests/Control/PanZoomBar.html

    r6724 r6799  
    3434        t.eq( control2.div.style.top, "100px", "2nd control div is located correctly"); 
    3535    } 
     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    } 
    3653 
    3754  </script>