Class DefaultResizeTool

    • Constructor Detail

      • DefaultResizeTool

        public DefaultResizeTool()
        Creates a new instance of ResizeTool
    • Method Detail

      • paint

        public void paint​(Graphics2D g2d)
        Description copied from interface: Tool
        Invoked by canvas to draw tool.
        Specified by:
        paint in interface Tool
        Overrides:
        paint in class AbstractTool
        Parameters:
        g2d - the Graphics2D context in which to paint
      • startTool

        public void startTool()
        Description copied from interface: Tool
        Invoked when the tool is started
        Specified by:
        startTool in interface Tool
        Overrides:
        startTool in class AbstractTool
      • endTool

        public void endTool()
        Description copied from interface: Tool
        Invoked when the tool is ended
        Specified by:
        endTool in interface Tool
        Overrides:
        endTool in class AbstractTool
      • determineDirection

        protected int determineDirection​(int x,
                                         int y)
        Determine direction. The direction is in phone keypad format.
        Parameters:
        x - the X
        y - the Y
        Returns:
        direction or -1
        See Also:
        CanvasSelection.getBorder()
      • createTransform

        protected AffineTransform createTransform()
        create resize transform
        Returns:
        AffineTransform
      • swap

        protected void swap​(double[] array,
                            int index1,
                            int index2)
      • updateDOM

        protected void updateDOM()
        update the model by scaling.
        1. get the selections bound in canvas transform
        2. create resizeAT based on the selections bounds (use selection bound x and y as translation point)
        3. get the globalTransform and canvasTransform
        4. transform using global and canvasTransform
        5. transform using resizeAT
        6. transform back using global and canvasTransform inverse Transform
      • updateOutline

        protected void updateOutline()
        update outline