Class MoveHandle

All Implemented Interfaces:
Handle

public class MoveHandle extends LocatorHandle
Handle for moving (translating) a figure.
Author:
Werner Randelshofer
  • Constructor Details

    • MoveHandle

      public MoveHandle(Figure figure, Locator locator)
  • Method Details

    • getCursor

      public javafx.scene.Cursor getCursor()
      Description copied from interface: Handle
      The cursor that should be shown when the mouse hovers over a selectable handle. Non-selectable handles should return null.
      Returns:
      the cursor
    • getNode

      public @NonNull javafx.scene.Node getNode(@NonNull DrawingView view)
      Description copied from interface: Handle
      Returns the node which is used to visualize the handle. The node is rendered by DrawingView in a pane which uses view coordinates. The node should use DrawingView.viewToDrawingProperty() to transform its coordinates.

      A Handle can only reside in one DrawingView at any given time. The JavaFX node returned by this method is use to render the handle in the DrawingView. This is why, unlike Figure, we only need this method instead of a createNode and an updateNode method.

      A HandleTracker will use the Node.accessibleTextProperty() and Node.accessibleHelpProperty() to provide a help text to the user.

      Parameters:
      view - the drawing view
      Returns:
      the node
    • updateNode

      public void updateNode(@NonNull DrawingView view)
      Description copied from interface: Handle
      Updates the node.
      Parameters:
      view - the drawing view
    • onMousePressed

      public void onMousePressed(@NonNull javafx.scene.input.MouseEvent event, @NonNull DrawingView view)
    • onMouseDragged

      public void onMouseDragged(@NonNull javafx.scene.input.MouseEvent event, @NonNull DrawingView view)
    • doTranslateFigure

      protected void doTranslateFigure(@NonNull Figure f, @NonNull CssPoint2D oldPoint, @NonNull CssPoint2D newPoint, @Nullable DrawingModel model)
    • translateFigure

      public static void translateFigure(@NonNull Figure f, @NonNull javafx.geometry.Point2D oldPoint, @NonNull javafx.geometry.Point2D newPoint, @Nullable DrawingModel model)
      Translates the specified figure, given the old and new position of a point.
      Parameters:
      f - the figure to be translated
      oldPoint - oldPoint in world coordinates
      newPoint - newPoint in world coordinates
      model - the drawing model
    • translateFigure

      public static void translateFigure(@NonNull Figure f, @NonNull CssPoint2D oldPoint, @NonNull CssPoint2D newPoint, @Nullable DrawingModel model)
      Translates the specified figure, given the old and new position of a point.
      Parameters:
      f - the figure to be translated
      oldPoint - oldPoint in world coordinates
      newPoint - newPoint in world coordinates
      model - the drawing model
    • onMouseReleased

      public void onMouseReleased(@NonNull javafx.scene.input.MouseEvent event, @NonNull DrawingView dv)
    • isSelectable

      public boolean isSelectable()
      Description copied from interface: Handle
      Whether the handle is selectable.
      Returns:
      true if selectable
    • getLocationInView

      public javafx.geometry.Point2D getLocationInView()