Class PieceMover.DragHandlerNoImage
java.lang.Object
VASSAL.build.module.map.PieceMover.AbstractDragHandler
VASSAL.build.module.map.PieceMover.DragHandlerNoImage
- All Implemented Interfaces:
DragGestureListener,DragSourceListener,DragSourceMotionListener,DropTargetListener,EventListener
- Enclosing class:
PieceMover
Fallback drag-handler when DragImage not supported by JRE. Implements a
pseudo-cursor that follows the mouse cursor when user drags game pieces.
Supports map zoom by resizing cursor when it enters a drop target of
type Map.View.
- Version:
- 0.4.2
- Author:
- Jim Urbas
-
Nested Class Summary
Nested classes/interfaces inherited from class VASSAL.build.module.map.PieceMover.AbstractDragHandler
PieceMover.AbstractDragHandler.AbstractDragHandlerFactory -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Componentprotected final Pointprotected JLayeredPaneprotected ComponentFields inherited from class VASSAL.build.module.map.PieceMover.AbstractDragHandler
boundingBox, boundingBoxComp, currentPieceOffsetX, currentPieceOffsetY, CURSOR_ALPHA, dragCursor, dragCursorZoom, dragPieceOffCenterZoom, dropTargetListeners, EXTRA_BORDER, lastDragLocation, pieceMovers -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcalculates the offset between cursor dragCursor positionsvoidDRAG SOURCE LISTENER INTERFACEvoidDROP TARGET INTERFACE EVENT uses UNSCALED, DROP-TARGET coordinate system dragEnter - switches current drawWin when mouse enters a new DropTargetvoidDRAG GESTURE LISTENER INTERFACE EVENT uses SCALED, DRAG-SOURCE coordinate system.voidDRAG SOURCE MOTION LISTENER INTERFACE EVENT uses UNSCALED, SCREEN coordinate system Moves cursor after mouse.voidDROP TARGET INTERFACE EVENT uses UNSCALED, DROP-TARGET coordinate system drop() - Last event of the drop operation.protected doubleprotected doubleprotected intprotected voidmakeDragCursor(double zoom) Deprecated, for removal: This API element is subject to removal in a future version.protected voidmakeDragCursor(double zoom, double os_scale) Installs the cursor image into our dragCursor JLabel.protected voidmoveDragCursor(int dragX, int dragY) Moves the drag cursor on the current draw windowprotected voidRemoves the drag cursor from the current draw windowvoidsetDrawWinToOwnerOf(Component newDropWin) creates or moves cursor object to given window.Methods inherited from class VASSAL.build.module.map.PieceMover.AbstractDragHandler
addPieceMover, beginDragging, dragEnter, dragExit, dragExit, dragGestureRecognizedPrep, dragOver, dragOver, dropActionChanged, dropActionChanged, getListener, getTheDragHandler, makeDragImageCursorCommon, makeDragImageCursorCommon, makeDropTarget, removeDropTarget, resetDragHandler, resetRecursivePieceSlots, setTheDragHandler
-
Field Details
-
dragWin
-
dropWin
-
drawWin
-
drawOffset
-
-
Constructor Details
-
DragHandlerNoImage
public DragHandlerNoImage()
-
-
Method Details
-
dragGestureRecognized
Description copied from class:PieceMover.AbstractDragHandlerDRAG GESTURE LISTENER INTERFACE EVENT uses SCALED, DRAG-SOURCE coordinate system. ("component coordinates") PIECE uses SCALED, OWNER (arbitrary) coordinate system ("map coordinates") Fires after user begins moving the mouse several pixels over a map. This method will be overridden, but called as a super(), by the Drag Gesture extension that is used, which will either bePieceMover.DragHandlerif DragImage is supported by the JRE, orPieceMover.DragHandlerNoImageif not. Either one will have calledPieceMover.AbstractDragHandler.dragGestureRecognizedPrep(java.awt.dnd.DragGestureEvent), immediately below, before it calls this method.- Specified by:
dragGestureRecognizedin interfaceDragGestureListener- Overrides:
dragGestureRecognizedin classPieceMover.AbstractDragHandler
-
makeDragCursor
Deprecated, for removal: This API element is subject to removal in a future version.- Overrides:
makeDragCursorin classPieceMover.AbstractDragHandler
-
makeDragCursor
protected void makeDragCursor(double zoom, double os_scale) Installs the cursor image into our dragCursor JLabel. Sets current zoom. Should be called at beginning of drag and whenever zoom changes. INPUT: DragBuffer.getBuffer OUTPUT: dragCursorZoom cursorOffCenterX cursorOffCenterY boundingBox- Parameters:
zoom- DragBuffer.getBuffer
-
moveDragCursor
protected void moveDragCursor(int dragX, int dragY) Moves the drag cursor on the current draw window- Overrides:
moveDragCursorin classPieceMover.AbstractDragHandler- Parameters:
dragX- x positiondragY- y position
-
removeDragCursor
protected void removeDragCursor()Removes the drag cursor from the current draw window- Overrides:
removeDragCursorin classPieceMover.AbstractDragHandler
-
calcDrawOffset
protected void calcDrawOffset()calculates the offset between cursor dragCursor positions- Overrides:
calcDrawOffsetin classPieceMover.AbstractDragHandler
-
setDrawWinToOwnerOf
creates or moves cursor object to given window. Called when drag operation begins in a window or the cursor is dragged over a new drop-target window- Overrides:
setDrawWinToOwnerOfin classPieceMover.AbstractDragHandler- Parameters:
newDropWin- window component to be our new draw window.
-
getOffsetMult
protected int getOffsetMult()- Specified by:
getOffsetMultin classPieceMover.AbstractDragHandler- Returns:
- platform-dependent offset multiplier
-
getDeviceScale
- Specified by:
getDeviceScalein classPieceMover.AbstractDragHandler- Parameters:
dge- DG event- Returns:
- platform-dependent device scale
-
getDeviceScale
- Specified by:
getDeviceScalein classPieceMover.AbstractDragHandler
-
dragDropEnd
Description copied from class:PieceMover.AbstractDragHandlerDRAG SOURCE LISTENER INTERFACE- Specified by:
dragDropEndin interfaceDragSourceListener- Overrides:
dragDropEndin classPieceMover.AbstractDragHandler- Parameters:
e- DragSourceDropEvent
-
dragMouseMoved
Description copied from class:PieceMover.AbstractDragHandlerDRAG SOURCE MOTION LISTENER INTERFACE EVENT uses UNSCALED, SCREEN coordinate system Moves cursor after mouse. Used to check for real mouse movement. Warning: dragMouseMoved fires 8 times for each point on development system (Win2k)- Specified by:
dragMouseMovedin interfaceDragSourceMotionListener- Overrides:
dragMouseMovedin classPieceMover.AbstractDragHandler
-
dragEnter
Description copied from class:PieceMover.AbstractDragHandlerDROP TARGET INTERFACE EVENT uses UNSCALED, DROP-TARGET coordinate system dragEnter - switches current drawWin when mouse enters a new DropTarget- Specified by:
dragEnterin interfaceDropTargetListener- Overrides:
dragEnterin classPieceMover.AbstractDragHandler
-
drop
Description copied from class:PieceMover.AbstractDragHandlerDROP TARGET INTERFACE EVENT uses UNSCALED, DROP-TARGET coordinate system drop() - Last event of the drop operation. We adjust the drop point for off-center drag, remove the cursor, and pass the event along listener chain.- Specified by:
dropin interfaceDropTargetListener- Overrides:
dropin classPieceMover.AbstractDragHandler
-