Package jpicedt.graphic.toolkit
Class EditElementMouseTransformFactory.MoveControlPointTransform
- java.lang.Object
-
- jpicedt.graphic.toolkit.EditElementMouseTransformFactory.MoveControlPointTransform
-
- All Implemented Interfaces:
MouseTransform
- Enclosing class:
- EditElementMouseTransformFactory
protected class EditElementMouseTransformFactory.MoveControlPointTransform extends java.lang.Object implements MouseTransform
a mouse-transform that moves element's end-points, ie aka scales elements. Code is heavily dependent on the run-time class of the target element. [pending] one shortcoming of the present approach is that EditPointConstraint's are set at init time (i.e. in the constructor), which forbids any further modification (e.g. if the user press the control key AFTER starting to drag a point).
-
-
Constructor Summary
Constructors Constructor Description MoveControlPointTransform(Element target, int pointIndex, EditPointConstraint constraint, java.lang.String helpMessage, Grid grid)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.CursorgetCursor()Return the cursor for this MouseTransformjava.lang.StringgetHelpMessage()Return a help-message for the UI, that makes sense with this transform.booleannext(PEMouseEvent e)Called when the mouse is released.voidpaint(java.awt.Graphics2D g, java.awt.geom.Rectangle2D allocation, double scale)Does nothing.voidprocess(PEMouseEvent e)Called when the mouse is dragged.voidstart(PEMouseEvent e)Called when the mouse is pressed.java.lang.StringtoString()
-
-
-
Constructor Detail
-
MoveControlPointTransform
public MoveControlPointTransform(Element target, int pointIndex, EditPointConstraint constraint, java.lang.String helpMessage, Grid grid)
- Parameters:
target- the element upon which this transform will actpointIndex- index of the Element's point that will be movedgrid- the Grid instance used for alignment (if it's snap-on)constraint- the geometrical constraint to be used when moving control-points ; may be nullhelpMessage- if non-null, this will be displayed on mouse-move events instead of the default help-message for this mouse-transform.- See Also:
jpicedt.graphic.model.Element.setPoint
-
-
Method Detail
-
start
public void start(PEMouseEvent e)
Called when the mouse is pressed. This just fires a begin-undoable-event.- Specified by:
startin interfaceMouseTransform
-
process
public void process(PEMouseEvent e)
Called when the mouse is dragged. Sets the Element's point (with the index and the constraint given as a parameter in the constructor) to the current mouse position, or its nearest-neighbour on the grid if grid-snap is on.- Specified by:
processin interfaceMouseTransform
-
next
public boolean next(PEMouseEvent e)
Called when the mouse is released. This fires an end-undoable-event.- Specified by:
nextin interfaceMouseTransform- Returns:
- true if there's another task in the sequence, false if mouse-transform has completed with this mouse-event.
-
paint
public void paint(java.awt.Graphics2D g, java.awt.geom.Rectangle2D allocation, double scale)Does nothing. Nothing to painted specifically for this tool.- Specified by:
paintin interfaceMouseTransform
-
getHelpMessage
public java.lang.String getHelpMessage()
Description copied from interface:MouseTransformReturn a help-message for the UI, that makes sense with this transform.- Specified by:
getHelpMessagein interfaceMouseTransform- Returns:
- a help-message for the UI, that makes sense with this transform.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- a textual representation of this transform for debugging purpose
-
getCursor
public java.awt.Cursor getCursor()
Description copied from interface:MouseTransformReturn the cursor for this MouseTransform- Specified by:
getCursorin interfaceMouseTransform- Returns:
- a cursor adequate with this mouse-transform, delegating to CursorFactory.
If the target-element of
PicGroup, returns a cursor according topointIndex.
-
-