Changeset 626

Show
Ignore:
Timestamp:
07/20/08 23:17:52 (2 months ago)
Author:
tom
Message:

in tweening branch: fixed another issue with seams in TileGrid, implemented a default copyright textfield, return empty array for tiles above and below the poles in abstract map provider

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/tom-tweenlite/lib/com/modestmaps/core/TileGrid.as

    r625 r626  
    557557                                tile.scaleX = tile.scaleY = Math.ceil(tileScales[tile.zoom] * tileWidth) / tileWidth;; 
    558558 
    559                               if (!zooming) { 
     559                              if (!zooming) { 
    560560                                        // this also helps the rare seams not fixed by rounding the tile scale,  
    561561                                        // but makes slow zooming uglier:  
    562                                         tile.x = Math.floor(positionCol*tileWidth*positionScaleCompensation); 
    563                                         tile.y = Math.floor(positionRow*tileHeight*positionScaleCompensation); 
     562                                        // round, not floor, because the latter causes artifacts at lower zoom levels :( 
     563                                        tile.x = Math.round(positionCol*tileWidth*positionScaleCompensation); 
     564                                        tile.y = Math.round(positionRow*tileHeight*positionScaleCompensation); 
    564565                                } 
    565566                                else { 
  • branches/tom-tweenlite/lib/com/modestmaps/extras/MapCopyright.as

    r625 r626  
    66        import com.modestmaps.geo.Location; 
    77         
    8         import flash.events.EventDispatcher
     8        import flash.display.Sprite
    99        import flash.external.ExternalInterface; 
     10        import flash.text.TextField; 
     11        import flash.text.TextFormat; 
    1012        import flash.utils.clearTimeout; 
    1113        import flash.utils.setTimeout; 
     
    2022         * without requiring javascript, and without needing to edit this file. 
    2123         */ 
    22         public class MapCopyright extends EventDispatcher 
     24        [Event(name="copyrightChanged", type="com.modestmaps.events.MapEvent")]  
     25        public class MapCopyright extends Sprite 
    2326        { 
    2427                private static const script_js:XML = <script> 
     
    207210                public var copyright:String = ""; 
    208211 
     212                public var copyrightField:TextField; 
     213 
    209214                public function MapCopyright(map:Map) 
    210215                { 
     
    231236                map.addEventListener(MapEvent.RESIZED, onMapChange); 
    232237 
     238                        copyrightField = new TextField(); 
     239                        copyrightField.defaultTextFormat = new TextFormat('Arial', 10, 0x000000, false); 
     240                        copyrightField.selectable = copyrightField.mouseEnabled = false; 
     241                        addChild(copyrightField); 
    233242                } 
    234243                 
     
    241250                } 
    242251                copyrightTimeout = setTimeout(callCopyright, 250); 
     252                 
     253                if (event.type == MapEvent.RESIZED) { 
     254                                copyrightField.x = map.getWidth() - copyrightField.width - 10; 
     255                                copyrightField.y = map.getHeight() - copyrightField.height - 10;                         
     256                } 
    243257            } 
    244258             
     
    276290        *  
    277291        *   to display the copyright string in your flash piece, you then need to listen for  
    278         *   the COPYRIGHT_CHANGED MapEvent 
     292        *   the COPYRIGHT_CHANGED MapEvent, or add MapCopyright as a child of map for a basic implementation. 
    279293            */ 
    280294            public function setCopyright(copyright:String):void { 
    281295                this.copyright = copyright; 
    282296                this.copyright = this.copyright.replace(/&copy;/g,"©"); 
     297 
     298                        copyrightField.htmlText = this.copyright; 
     299                        copyrightField.width = copyrightField.textWidth + 4; 
     300                        copyrightField.height = copyrightField.textHeight + 4; 
     301                        copyrightField.x = map.getWidth() - copyrightField.width - 10; 
     302                        copyrightField.y = map.getHeight() - copyrightField.height - 10; 
     303                                                 
    283304                dispatchEvent(new MapEvent(MapEvent.COPYRIGHT_CHANGED, this.copyright)); 
    284305            } 
  • branches/tom-tweenlite/lib/com/modestmaps/mapproviders/AbstractMapProvider.as

    r604 r626  
    7575                     
    7676                    // we don't wrap rows here because the map/grid should be enforcing outerLimits :) 
    77                     // they aren't 
    78                     // TODO: wrap rows or enforce outer limits :) 
    7977                         
    8078                return new Coordinate(coord.row, wrappedColumn, coord.zoom); 
  • branches/tom-tweenlite/lib/com/modestmaps/mapproviders/microsoft/MicrosoftProvider.as

    r609 r626  
    8383                public function getTileUrls(coord:Coordinate):Array 
    8484                { 
     85                        if (coord.row < 0 || coord.row >= Math.pow(2, coord.zoom)) { 
     86                                return []; 
     87                        } 
    8588                        // this is so that requests will be consistent in this session, rather than totally random 
    8689                        var server:int = (serverSalt + coord.row + coord.column + coord.zoom) % 4;