Package edu.cnu.mdi.graphics.rubberband
Class RubberRectPreserveAspect
java.lang.Object
edu.cnu.mdi.graphics.rubberband.ARubberband
edu.cnu.mdi.graphics.rubberband.ADragRubberband
edu.cnu.mdi.graphics.rubberband.RubberRectPreserveAspect
- All Implemented Interfaces:
MouseListener,MouseMotionListener,EventListener
Rubberband rectangle that preserves aspect ratio (square in screen space).
Matches the old Rubberband Policy.RECTANGLE_PRESERVE_ASPECT behavior.
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.cnu.mdi.graphics.rubberband.ARubberband
ARubberband.Policy -
Field Summary
Fields inherited from class edu.cnu.mdi.graphics.rubberband.ARubberband
active, backgroundImage, component, currentPt, fillColor, highlightColor1, highlightColor2, image, policy, poly, rubberbanded, started, startPt, tempPoly -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddraw(Graphics2D g) Draw the rubberband shape based on the current state.Get the bounding rectangle of the rubberband shape based on the current state.protected voidHook to modify the current point before using it.Methods inherited from class edu.cnu.mdi.graphics.rubberband.ADragRubberband
mouseDragged, mousePressed, mouseReleasedMethods inherited from class edu.cnu.mdi.graphics.rubberband.ARubberband
addPoint, begin, cancel, computeVertices, endRubberbanding, getCurrent, getRubberbandVertices, getStart, isActive, isClickBased, isGestureValid, mouseClicked, mouseEntered, mouseExited, mouseMoved, setActive, setCurrent, setFillColor, setHighlightColor1, setHighlightColor2, startRubberbanding
-
Constructor Details
-
RubberRectPreserveAspect
-
-
Method Details
-
modifyCurrentPoint
Description copied from class:ARubberbandHook to modify the current point before using it. Default: clamp to component bounds (old Rubberband behavior).- Overrides:
modifyCurrentPointin classARubberband
-
draw
Description copied from class:ARubberbandDraw the rubberband shape based on the current state. Called during dragging or when the toolbar requests a preview update. Subclasses must implement this to define the visual appearance of the rubberband.- Specified by:
drawin classARubberband- Parameters:
g-
-
getRubberbandBounds
Description copied from class:ARubberbandGet the bounding rectangle of the rubberband shape based on the current state. Used for area-based validity checks and as a default for vertex calculations. Subclasses should override this if their shape is not well-represented by a bounding rectangle (e.g. lines, polygons).- Specified by:
getRubberbandBoundsin classARubberband- Returns:
- the bounding rectangle of the rubberband shape, or null if not applicable.
-