Class AbstractCanvasListener

    • Field Detail

      • AUTO_SCROLL_SPACE

        protected static final int AUTO_SCROLL_SPACE
        Space to auto-scroll.
        See Also:
        Constant Field Values
      • DRAG_SCROLL_SPACE

        private static final int DRAG_SCROLL_SPACE
        Space to drag-scroll.
        See Also:
        Constant Field Values
      • scrollThread

        private static volatile ScrollThread scrollThread
        The scroll thread itself.
      • scrollThreadLock

        private static volatile java.lang.Object scrollThreadLock
    • Constructor Detail

      • AbstractCanvasListener

        protected AbstractCanvasListener​(FreeColClient freeColClient)
        Create a new AbstractCanvasListener.
        Parameters:
        freeColClient - The FreeColClient for the game.
    • Method Detail

      • performAutoScrollIfActive

        protected void performAutoScrollIfActive​(java.awt.event.MouseEvent e,
                                                 boolean ignoreTop)
        Auto-scroll to a mouse position if necessary.
        Parameters:
        e - The MouseEvent that initiating the scroll.
        ignoreTop - If the top should be ignored (to avoid scrolling when the mouse is over the top of the map, as the menu bar above is checked already)
      • performDragScrollIfActive

        protected void performDragScrollIfActive​(java.awt.event.MouseEvent e)
        Drag-scroll to a mouse position if necessary.
        Parameters:
        e - The MouseEvent that initiating the scroll.
      • stopScrollIfScrollIsActive

        protected void stopScrollIfScrollIsActive()
        Stop scrolling.
      • scroll

        private void scroll​(int x,
                            int y,
                            int scrollSpace,
                            boolean ignoreTop)
        Scroll the map if the given (x,y) coordinate is close to an edge.
        Parameters:
        x - The x coordinate.
        y - The y coordinate.
        scrollSpace - The clearance from the relevant edge
        ignoreTop - If the top should be ignored