Class LensTranslatingGraphMousePlugin

  • All Implemented Interfaces:
    GraphMousePlugin, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener

    public class LensTranslatingGraphMousePlugin
    extends TranslatingGraphMousePlugin
    implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener
    Extends TranslatingGraphMousePlugin and adds the capability to drag and resize the viewing lens in the graph view. Mouse1 in the center moves the lens, mouse1 on the edge resizes the lens. The default mouse button and modifiers can be overridden in the constructor.
    • Field Detail

      • dragOnLens

        protected boolean dragOnLens
      • dragOnEdge

        protected boolean dragOnEdge
      • edgeOffset

        protected double edgeOffset
    • Constructor Detail

      • LensTranslatingGraphMousePlugin

        public LensTranslatingGraphMousePlugin()
        create an instance with default modifiers
      • LensTranslatingGraphMousePlugin

        public LensTranslatingGraphMousePlugin​(int modifiers)
        create an instance with passed modifer value
        Parameters:
        modifiers - the mouse event modifier to activate this function
    • Method Detail

      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Check the event modifiers. Set the 'down' point for later use. If this event satisfies the modifiers, change the cursor to the system 'move cursor'
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Overrides:
        mousePressed in class TranslatingGraphMousePlugin
        Parameters:
        e - the event
      • setViewCenter

        private void setViewCenter​(MutableTransformer transformer,
                                   java.awt.geom.Point2D point)
        called to change the location of the lens
        Parameters:
        Function -
        point -
      • setViewRadius

        private void setViewRadius​(MutableTransformer transformer,
                                   java.awt.geom.Point2D point)
        called to change the radius of the lens
        Parameters:
        Function -
        point -
      • testViewCenter

        private void testViewCenter​(MutableTransformer transformer,
                                    java.awt.geom.Point2D point)
        called to set up translating the lens center or changing the size
        Parameters:
        Function -
        point -
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        unset the 'down' point and change the cursoe back to the system default cursor
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        Overrides:
        mouseReleased in class TranslatingGraphMousePlugin
      • mouseDragged

        public void mouseDragged​(java.awt.event.MouseEvent e)
        check the modifiers. If accepted, move or resize the lens according to the dragging of the mouse pointer
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
        Overrides:
        mouseDragged in class TranslatingGraphMousePlugin
        Parameters:
        e - the event