Show
Ignore:
Timestamp:
01/24/08 18:37:41 (8 months ago)
Author:
tom
Message:

disabling double click to center by default, use grid.setDoubleClickEnabled to undo

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/as3/lib/com/modestmaps/core/TileGrid.as

    r447 r455  
    77{ 
    88    import com.modestmaps.Map; 
     9    import com.modestmaps.geo.Location; 
    910    import com.modestmaps.mapproviders.IMapProvider; 
    10     import com.modestmaps.core.*; 
    11     import com.modestmaps.geo.Location; 
    1211    import com.stamen.twisted.*; 
    13  
     12     
     13    import flash.display.Sprite; 
     14    import flash.events.Event; 
     15    import flash.events.MouseEvent; 
    1416    import flash.geom.Point; 
    15     import flash.display.Sprite; 
     17    import flash.geom.Rectangle; 
    1618    import flash.utils.Dictionary; 
    17     import flash.geom.Rectangle; 
    18     import flash.events.MouseEvent; 
    19     import flash.events.Event; 
    20     import flash.display.Stage; 
    2119     
    2220    public class TileGrid extends Sprite 
     
    216214                _well.addEventListener(MouseEvent.MOUSE_DOWN, startWellDrag); 
    217215                _well.addEventListener(MouseEvent.MOUSE_UP, stopWellDrag); 
    218                 _well.addEventListener(MouseEvent.DOUBLE_CLICK, onWellDoubleClick); 
    219216                _well.doubleClickEnabled = true; 
    220217            } 
     
    236233            this.mask = _mask; 
    237234        } 
    238          
     235 
     236                public function setDoubleClickEnabled(enabled:Boolean):void 
     237                { 
     238                        if (enabled) { 
     239                _well.addEventListener(MouseEvent.DOUBLE_CLICK, onWellDoubleClick); 
     240                        } 
     241                        else if (_well.hasEventListener(MouseEvent.DOUBLE_CLICK)) { 
     242                                _well.removeEventListener(MouseEvent.DOUBLE_CLICK, onWellDoubleClick); 
     243                        } 
     244                }         
    239245         
    240246        public function getMapProvider():IMapProvider 
     
    454460            var p:Point = new Point(event.localX, event.localY); 
    455461            var l:Location = _map.pointLocation(p,_well); 
    456             _map.setCenter(l); 
     462            _map.panTo(l); 
    457463        } 
    458464