public const NOT_DRAGGING:uint=0; // |
public const NOT_MOVED:uint=1; // |
public const DRAGGING:uint=2; // |
+ public const SWALLOW_MOUSEUP:uint=3; // |
/** How far the map can be dragged without actually triggering a pan. */
public const TOLERANCE:uint=7; // |
/** Prepare for being dragged by recording start time and location of mouse. */
public function mouseDownHandler(event:MouseEvent):void {
if (!_draggable) { return; }
- dragstate=NOT_MOVED;
+ if (dragstate==DRAGGING) { moveMap(x,y); dragstate=SWALLOW_MOUSEUP; } // cancel drag if mouse-up occurred outside the window (thanks, Safari)
+ else { dragstate=NOT_MOVED; }
lastxmouse=stage.mouseX; downX=stage.mouseX;
lastymouse=stage.mouseY; downY=stage.mouseY;
downTime=new Date().getTime();
import mx.core.DragSource;
private function dragPOI(event:MouseEvent, tags:Array):void {
+ if (outerDocument.controller.map.dragstate==outerDocument.controller.map.DRAGGING) return;
+
// Get the drag initiator component from the event object.
var dragInitiator:Image = event.currentTarget as Image;
var dragSource:DragSource = new DragSource();
var paint:MapPaint = getMapPaint(DisplayObject(event.target));
var focus:Entity = getTopLevelFocusEntity(entity);
- if (event.type==MouseEvent.MOUSE_UP && (focus==null || (paint && paint.isBackground)) && map.dragstate!=map.DRAGGING) {
+ if (event.type==MouseEvent.MOUSE_UP && (focus==null || (paint && paint.isBackground)) && map.dragstate!=map.DRAGGING && map.dragstate!=map.SWALLOW_MOUSEUP) {
map.dragstate=map.NOT_DRAGGING;
// ** FIXME: BeginWayAction ought to be a discrete class
var undo:CompositeUndoableAction = new BeginWayAction();