Interface PreviewMouseListener


  • public interface PreviewMouseListener

    Listener for mouse events in Preview.

    Listeners will always receive left mouse button events. Right button is reserved for zooming and moving the canvas

    In order to enable a PreviewMouseListener, annotate it with ServiceProvider annotation and implement MouseResponsiveRenderer in a Renderer and return true for the listener in the needsPreviewMouseListener method.

    Author:
    Eduardo Ramos
    • Method Detail

      • mouseClicked

        void mouseClicked​(PreviewMouseEvent event,
                          PreviewProperties properties,
                          Workspace workspace)
        A single click event.
        Parameters:
        event - Mouse event
        properties - Preview properties for the workspace
        workspace - Current workspace
      • mousePressed

        void mousePressed​(PreviewMouseEvent event,
                          PreviewProperties properties,
                          Workspace workspace)
        A mouse press event. If your listener needs to receive drag or release events, you must mark the previous press event as consumed.
        Parameters:
        event - Mouse event
        properties - Preview properties for the workspace
        workspace - Current workspace
      • mouseDragged

        void mouseDragged​(PreviewMouseEvent event,
                          PreviewProperties properties,
                          Workspace workspace)
        If your listener needs to receive drag events, you must mark the previous press event as consumed.
        Parameters:
        event - Mouse event
        properties - Preview properties for the workspace
        workspace - Current workspace
      • mouseReleased

        void mouseReleased​(PreviewMouseEvent event,
                           PreviewProperties properties,
                           Workspace workspace)
        If your listener needs to receive release events, you must mark the previous press event as consumed.
        Parameters:
        event - Mouse event
        properties - Preview properties for the workspace
        workspace - Current workspace