Changeset 279
- Timestamp:
- 05/11/07 14:48:40 (2 years ago)
- Files:
-
- branches/AS3/as3/lib/com/modestmaps/Map.as (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/AS3/as3/lib/com/modestmaps/Map.as
r265 r279 160 160 Reactor.callNextFrame(callCopyright); 161 161 } 162 162 163 /* 164 * Based on a zoom level, determine appropriate initial 165 * tile coordinate and point using calculateMapCenter(), and inform 166 * the grid of tile coordinate and point by calling grid.resetTiles(). 167 * 168 * @param Desired zoom level. 169 * 170 * @see com.modestmaps.Map#calculateMapExtent 171 * @see com.modestmaps.core.TileGrid#resetTiles 172 */ 173 public function setZoom(zoom:Number):void 174 { 175 if (zoom == grid.zoomLevel) { // do nothing! 176 return; 177 } 178 else if (zoom - grid.zoomLevel == 1) { // if 1 step in, delegate to zoomIn animation 179 zoomIn(); 180 } 181 else if (zoom - grid.zoomLevel == -1) { // if 1 step out, delegate to zoomOut animation 182 zoomOut(); 183 } 184 else { // else hard reset 185 var center:MapPosition = coordinatePosition(grid.centerCoordinate().zoomTo(zoom)); 186 // tell grid what the rock is cooking 187 grid.resetTiles(center.coord, center.point); 188 onExtentChanged(this.getExtent()); 189 Reactor.callNextFrame(callCopyright); 190 } 191 } 192 163 193 /* 164 194 * Based on a coordinate, determine appropriate starting tile and position, … … 168 198 { 169 199 // initial tile coordinate 170 var initTileCoord:Coordinate = new Coordinate( Math.floor(centerCoord.row),171 Math.floor(centerCoord.column),172 Math.floor(centerCoord.zoom));200 var initTileCoord:Coordinate = new Coordinate( Math.floor(centerCoord.row), 201 Math.floor(centerCoord.column), 202 Math.floor(centerCoord.zoom)); 173 203 174 204 // initial tile position, assuming centered tile well in grid … … 529 559 grid.panDown(pan.amount.y); 530 560 531 __currentPosition.x += pan.amount.x;532 __currentPosition.y += pan.amount.y;561 __currentPosition.x -= pan.amount.x; // panning right actually moves the map left 562 __currentPosition.y -= pan.amount.y; // panning up actually moves the map down 533 563 onPanned(new Point(__currentPosition.x-__startingPosition.x, __currentPosition.y-__startingPosition.y)); 534 564 }
