OpenLayers OpenLayers

Changeset 6411

Show
Ignore:
Timestamp:
02/29/08 01:03:12 (6 months ago)
Author:
crschmidt
Message:

panmethod option on map to allow for the turning off of animated panning.
Includes example. All tests pass. r=tschaub. (Closes #1356)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/examples/animated_panning.html

    r6145 r6411  
    55    <style type="text/css"> 
    66        #map { 
     7            width: 512px; 
     8            height: 256px; 
     9            border: 1px solid black; 
     10        } 
     11        #map2 { 
    712            width: 512px; 
    813            height: 256px; 
     
    5156            click.activate(); 
    5257            map.addControl(new OpenLayers.Control.OverviewMap()); 
     58 
     59            map2 = new OpenLayers.Map('map2', {'panMethod': null} ); 
     60            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",  
     61                "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); 
     62                 
     63            map2.addLayer(layer); 
     64            map2.zoomToMaxExtent(); 
    5365        } 
    5466 
     
    7789    <div id="map"></div> 
    7890    <div id="docs"> 
    79         This is an example of transition effects. If the new random center is in the current extent, the map will pan smoothly. <br /> 
     91        <p>This is an example of transition effects. If the new random center is in the current extent, the map will pan smoothly. <br /> 
    8092        The random selection will continue until you press it again. Additionally, you can single click in the map to pan smoothly 
    8193        to that area, or use the pan control to pan smoothly. 
    82  
     94        </p> 
    8395    </div> 
    8496    <button onclick="setCenterInterval()">Start/stop random recenter</button> 
     97     <div id="map2"></div> 
     98    <div>     
     99    <p>To turn off Animated Panning, create a map with an panMethod set to 
     100        null. </p> 
     101    </div> 
    85102  </body> 
    86103</html> 
  • trunk/openlayers/lib/OpenLayers/Map.js

    r6398 r6411  
    327327 
    328328    /** 
     329     * Property: panMethod 
     330     * {Function} The Easing function to be used for tweening.  Default is 
     331     * OpenLayers.Easing.Expo.easeOut. Setting this to 'null' turns off 
     332     * animated panning. 
     333     */ 
     334    panMethod: OpenLayers.Easing.Expo.easeOut, 
     335     
     336    /** 
    329337     * Constructor: OpenLayers.Map 
    330338     * Constructor for a new OpenLayers.Map instance. 
     
    13181326     */ 
    13191327    panTo: function(lonlat) { 
    1320         if (this.getExtent().containsLonLat(lonlat)) { 
     1328        if (this.panMethod && this.getExtent().containsLonLat(lonlat)) { 
    13211329            if (!this.panTween) { 
    1322                 this.panTween = new OpenLayers.Tween(OpenLayers.Easing.Expo.easeOut); 
     1330                this.panTween = new OpenLayers.Tween(this.panMethod); 
    13231331            } 
    13241332            var center = this.getCenter();