OpenLayers OpenLayers

Ticket #1356: panAnimator.patch

File panAnimator.patch, 3.0 kB (added by tschaub, 10 months ago)

new name again, and consistency in the example

  • lib/OpenLayers/Map.js

    old new  
    326326    panTween: null, 
    327327 
    328328    /** 
     329     * Property: panAnimator 
     330     * {Function} The Easing method to be used for tweening.  Default is 
     331     * OpenLayers.Easing.Expo.easeOut. Setting this to 'null' turns off 
     332     * animated panning. 
     333     */ 
     334    panAnimator: OpenLayers.Easing.Expo.easeOut, 
     335     
     336    /** 
    329337     * Constructor: OpenLayers.Map 
    330338     * Constructor for a new OpenLayers.Map instance. 
    331339     * 
     
    13171325     * lonlat - {<OpenLayers.Lonlat>} 
    13181326     */ 
    13191327    panTo: function(lonlat) { 
    1320         if (this.getExtent().containsLonLat(lonlat)) { 
     1328        if (this.panAnimator && 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.panAnimator); 
    13231331            } 
    13241332            var center = this.getCenter(); 
    13251333            var from = { 
  • examples/animated_panning.html

    old new  
    88            height: 256px; 
    99            border: 1px solid black; 
    1010        } 
     11        #map2 { 
     12            width: 512px; 
     13            height: 256px; 
     14            border: 1px solid black; 
     15        } 
    1116    </style> 
    1217    <script src="../lib/OpenLayers.js"></script> 
    1318    <script type="text/javascript"> 
     
    5055            map.addControl(click); 
    5156            click.activate(); 
    5257            map.addControl(new OpenLayers.Control.OverviewMap()); 
     58 
     59            map2 = new OpenLayers.Map('map2', {panAnimator: 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 
    5567        function setCenterInterval() { 
     
    7688    <div id="shortdesc">Show animated panning effects in the map</div> 
    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 a panAnimator set to 
     100        null. </p> 
     101    </div> 
    85102  </body> 
    86103</html>