Changeset 5540
- Timestamp:
- 12/20/07 12:42:21 (1 year ago)
- Files:
-
- sandbox/enjahova/openlayers/lib/OpenLayers/Map.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/enjahova/openlayers/lib/OpenLayers/Map.js
r5518 r5540 136 136 viewRequestID: 0, 137 137 138 /** 139 * Property extents 140 * {Array} Used to store a history of the extents 141 */ 142 extents: [], 143 138 144 // Options 139 145 … … 377 383 // always call map.destroy() 378 384 OpenLayers.Event.observe(window, 'unload', this.unloadDestroy); 379 385 386 //keep track of previous extents so we can "undo" them Used by ZoomToLastExtent 387 var func = function () { 388 //console.log(this.getExtent()); 389 //console.log(this.getScale()); 390 this.extents.push(this.getExtent()); 391 } 392 this.events.register("moveend", map, func ); 380 393 }, 381 394 … … 1669 1682 }, 1670 1683 1684 /** 1685 * APIMethod: zoomToLastExtent 1686 * Zoom to the full extent and recenter. 1687 */ 1688 zoomToLastExtent: function() { 1689 //maybe not the cleanest way to do this (no 'redo') but it works 1690 if(this.extents.length > 1) 1691 { 1692 var tmp = this.extents.pop(); 1693 var last_extent = this.extents.pop(); 1694 this.zoomToExtent(last_extent); 1695 } 1696 else 1697 { 1698 this.zoomToMaxExtent(); 1699 this.extents.pop();this.extents.pop();//original extent should leave extents empty 1700 } 1701 }, 1702 1671 1703 /** 1672 1704 * APIMethod: zoomToScale
