File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ public CursorAction CursorAction
145145
146146 private Point lastClickedPoint ;
147147 private Point pressedDownPoint ;
148+ private MapTile pressedDownTile ;
148149
149150 /// <summary>
150151 /// Records whether the mouse was on the map UI when the left mouse button was pressed down.
@@ -405,14 +406,17 @@ public override void OnMouseOnControl()
405406 if ( Cursor . LeftPressedDown )
406407 {
407408 pressedDownPoint = cursorPoint ;
409+ pressedDownTile = tileUnderCursor ;
408410 }
409411 else if ( ! Cursor . LeftDown )
410412 {
411413 pressedDownPoint = new Point ( - 1 , - 1 ) ;
414+ pressedDownTile = null ;
412415 }
413416
414- // Attempt dragging or rotating an object
415- if ( CursorAction == null && tileUnderCursor != null && Cursor . LeftDown && ! isDraggingObject && ! isRotatingObject && cursorPoint != pressedDownPoint )
417+ // Attempt dragging or rotating an object.
418+ // To avoid accidental dragging, this requires the cursor to move within the cell that the left mouse button was first pressed down on.
419+ if ( CursorAction == null && tileUnderCursor != null && tileUnderCursor == pressedDownTile && Cursor . LeftDown && ! isDraggingObject && ! isRotatingObject && cursorPoint != pressedDownPoint )
416420 {
417421 var tilePosition = GetRelativeTilePositionFromCursorPosition ( tileUnderCursor ) ;
418422 var cellObject = tileUnderCursor . GetObject ( tilePosition ) ;
You can’t perform that action at this time.
0 commit comments