Ticket #1356: panmethod.patch
| File panmethod.patch, 3.0 kB (added by crschmidt, 10 months ago) |
|---|
-
lib/OpenLayers/Map.js
old new 326 326 panTween: null, 327 327 328 328 /** 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 /** 329 337 * Constructor: OpenLayers.Map 330 338 * Constructor for a new OpenLayers.Map instance. 331 339 * … … 1317 1325 * lonlat - {<OpenLayers.Lonlat>} 1318 1326 */ 1319 1327 panTo: function(lonlat) { 1320 if (this. getExtent().containsLonLat(lonlat)) {1328 if (this.panMethod && this.getExtent().containsLonLat(lonlat)) { 1321 1329 if (!this.panTween) { 1322 this.panTween = new OpenLayers.Tween( OpenLayers.Easing.Expo.easeOut);1330 this.panTween = new OpenLayers.Tween(this.panMethod); 1323 1331 } 1324 1332 var center = this.getCenter(); 1325 1333 var from = { -
examples/animated_panning.html
old new 8 8 height: 256px; 9 9 border: 1px solid black; 10 10 } 11 #map2 { 12 width: 512px; 13 height: 256px; 14 border: 1px solid black; 15 } 11 16 </style> 12 17 <script src="../lib/OpenLayers.js"></script> 13 18 <script type="text/javascript"> … … 50 55 map.addControl(click); 51 56 click.activate(); 52 57 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(); 53 65 } 54 66 55 67 function setCenterInterval() { … … 76 88 <div id="shortdesc">Show animated panning effects in the map</div> 77 89 <div id="map"></div> 78 90 <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 /> 80 92 The random selection will continue until you press it again. Additionally, you can single click in the map to pan smoothly 81 93 to that area, or use the pan control to pan smoothly. 82 94 </p> 83 95 </div> 84 96 <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 easingFunction set to 100 null. </p> 101 </div> 85 102 </body> 86 103 </html>
