Changeset 627

Show
Ignore:
Timestamp:
07/20/08 23:40:01 (1 month ago)
Author:
tom
Message:

make all this rounding stuff optional in tweening branch tilegrid, it affects visual stability in some apps

Files:

Legend:

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

    r626 r627  
    117117                protected static const DEFAULT_ENFORCE_BOUNDS:Boolean = true; 
    118118                protected static const DEFAULT_MAX_OPEN_REQUESTS:int = 4; // TODO: should this be split into max-new-requests-per-frame, too? 
     119                protected static const DEFAULT_ROUND_POSITIONS:Boolean = true; 
     120                protected static const DEFAULT_ROUND_SCALES:Boolean = true; 
    119121 
    120122                /** if we don't have a tile at currentZoom, onRender will look for tiles up to 5 levels out. 
     
    138140                // set this to true to enable enforcing of map bounds from the map provider's limits 
    139141                public var enforceBoundsEnabled:Boolean = DEFAULT_ENFORCE_BOUNDS; 
     142                 
     143                public var roundPositionsEnabled:Boolean = DEFAULT_ROUND_POSITIONS; 
     144                 
     145                public var roundScalesEnabled:Boolean = DEFAULT_ROUND_SCALES; 
    140146                 
    141147                public var mapWidth:Number; 
     
    542548                        for (var z:int = 0; z <= maxZoom; z++) { 
    543549                                scaleFactors[z] = Math.pow(2.0, currentTileZoom-z) 
    544                                 tileScales[z] = Math.pow(2, zoomLevel-z); 
     550                                 
     551                                // round up to the nearest pixel to avoid seams between zoom levels 
     552                                if (roundScalesEnabled) { 
     553                                        tileScales[z] = Math.ceil(Math.pow(2, zoomLevel-z) * tileWidth) / tileWidth;  
     554                                } 
     555                                else { 
     556                                        tileScales[z] = Math.pow(2, zoomLevel-z); 
     557                                } 
    545558                        } 
    546559                         
     
    554567                                var positionRow:Number = (scaleFactors[tile.zoom]*tile.row) - realMinRow; 
    555568 
    556                                 // round up to the nearest pixel to avoid seams between zoom levels  
    557                                 tile.scaleX = tile.scaleY = Math.ceil(tileScales[tile.zoom] * tileWidth) / tileWidth;; 
    558  
    559                                 if (!zooming) { 
     569                                tile.scaleX = tile.scaleY = tileScales[tile.zoom]; 
     570 
     571                                if (!zooming && roundPositionsEnabled) { 
    560572                                        // this also helps the rare seams not fixed by rounding the tile scale,  
    561573                                        // but makes slow zooming uglier:  
  • branches/tom-tweenlite/lib/com/modestmaps/mapproviders/microsoft/MicrosoftProvider.as

    r626 r627  
    8484                { 
    8585                        if (coord.row < 0 || coord.row >= Math.pow(2, coord.zoom)) { 
    86                                 return []
     86                                return null
    8787                        } 
    8888                        // this is so that requests will be consistent in this session, rather than totally random