Class TransformMouseOwner
java.lang.Object
java.awt.event.MouseAdapter
com.j3d.engine.interact.input.mouse.MouseOwner
com.j3d.engine.interact.input.mouse.SnapMouseOwner
com.j3d.engine.interact.cmd.commands.transform.mouse.TransformMouseOwner
- All Implemented Interfaces:
EventEmitterInterface,MouseListener,MouseMotionListener,MouseWheelListener,EventListener
- Direct Known Subclasses:
RotateMouseOwner,ScaleMouseOwner,TranslateMouseOwner
A specialized
MouseOwner that manages user interaction with a set of
3D transformation handles.
Responsible for detecting when a user clicks on a Handle,
selecting an axis for manipulation. Subclasses, such as TranslateMouseOwner
or ScaleMouseOwner, extend this class for either no additional stuff or extra
drawing using the handles.
- Author:
- Lehlogonolo Poole
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionintThe list of 3D handlesA direct reference to the currently selected handle object, or null.The type of the currently selected handle, or null if no handle is selected.The screen-space bounding box (as a radius) for detecting clicks on a handle.Fields inherited from class com.j3d.engine.interact.input.mouse.SnapMouseOwner
offset, snappingCandidatesFields inherited from class com.j3d.engine.interact.input.mouse.MouseOwner
registered -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanChecks if a mouse event's coordinates are within the circular bounding box of a handle's screen point.voidHandles mouse click events.voidHandles the mouse pressed event to detect handle selection.voidmousePressedAdapter(Handle handle) An adapter method called when a handle is successfully pressed.voidHandles the mouse released event.voidsetHandles(ArrayList<Handle> handles, ArrayList<GPoint> references) Sets the list of handles and the object references to be managed by this owner.voidsquare(Graphics2D g, int offset) Draws a debug rectangle around the mouse cursor's snapping region.Methods inherited from class com.j3d.engine.interact.input.mouse.SnapMouseOwner
clear, getMouseLocation, getSnappingCandidates, mouseMoved, snapEnabledMethods inherited from class com.j3d.engine.interact.input.mouse.MouseOwner
attachListener, broadcast, detachAll, detachListener, getMouseLoc, getMouseLocFromPhysical, getPhysicalMouse, getSelectionMouseLoc, isAttached, isNotOwner, mouseDragged, mouseDraggedUsingClickDelay, requestOwnership, sendMouseToCentre, setOldPoint, wrapMethods inherited from class java.awt.event.MouseAdapter
mouseEntered, mouseExited, mouseWheelMoved
-
Field Details
-
handles
The list of 3D handles -
selectedHandleType
The type of the currently selected handle, or null if no handle is selected. -
selectionBoundingBox
The screen-space bounding box (as a radius) for detecting clicks on a handle. -
distance
public int distance -
selectedHandle
A direct reference to the currently selected handle object, or null.
-
-
Constructor Details
-
TransformMouseOwner
Constructs a new TransformMouseOwner.- Parameters:
mw- The parentMOwnerthat manages all mouse owners.
-
-
Method Details
-
isWithinBounds
Checks if a mouse event's coordinates are within the circular bounding box of a handle's screen point.- Parameters:
e- The mouse event to check.p- The screen point of the handle.- Returns:
trueif the mouse click is on the handle,falseotherwise.
-
mousePressedAdapter
An adapter method called when a handle is successfully pressed. Subclasses can override this to perform specific actions upon handle selection.- Parameters:
handle- The handle that was pressed.
-
mousePressed
Handles the mouse pressed event to detect handle selection. It iterates through all managed handles and checks if the click was within the bounds of any of them. If a handle is clicked, it is marked as selected.- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classMouseAdapter- Parameters:
e- The mouse event.
-
mouseReleased
Handles the mouse released event. Subclasses often use this to finalize a transformation.- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classMouseOwner- Parameters:
e- The mouse event.
-
square
Draws a debug rectangle around the mouse cursor's snapping region.- Parameters:
g- TheGraphics2Dcontext to draw on.
-
setHandles
Sets the list of handles and the object references to be managed by this owner. -
mouseClicked
Description copied from class:SnapMouseOwnerHandles mouse click events. If a right-click occurs on a highlighted snap target, it broadcasts aEventType.SNAP_TO_OBJevent with thehoveringOverobject.- Specified by:
mouseClickedin interfaceMouseListener- Overrides:
mouseClickedin classSnapMouseOwner- Parameters:
e- TheMouseEventgenerated by the click.
-