java.lang.Object
com.levigo.jadice.web.client.util.helper.Points

public class Points extends Object
Helper Class for points. For angle calculation see https://coronalabs.com/blog/2013/01/22/implementing-pinch-zoom-rotate/
  • Method Details

    • calculateAngle

      public static double calculateAngle(Point vec11, Point vec12, Point vec21, Point vec22)
      Calculates the angle between the two given vectors
      Parameters:
      vec11 - starting point of the first vector
      vec12 - end point of the first vector
      vec21 - starting point of the second vector
      vec22 - end point of the second vector
      Returns:
      the angle in degrees
    • angleBetweenPositonVectors

      public static double angleBetweenPositonVectors(Point point1, Point point2)
      Calculates the degrees between two position vectors
      Parameters:
      point1 - the first point
      point2 - the second point
      Returns:
      the angle
    • angleOfPoint

      public static double angleOfPoint(Point point)
      Calculates the degrees between (0,0) and the given Point
      Parameters:
      point - the point
      Returns:
      the angle
    • getMousePoint

      public static Point2D getMousePoint(com.google.gwt.event.dom.client.MouseEvent<?> event, PageView pageView, Page page)
      Calculates the MousePosition in DocUnits relative to the Page.
      Parameters:
      event - the MouseEvent
      pageView - the PageView
      page - the pag
      Returns:
      the mouse position in XY Coordinates
    • getTouchPoint

      public static Point2D getTouchPoint(com.google.gwt.event.dom.client.TouchEvent<?> event, PageView pageView, Page page)
      Calculates the TouchPosition in DocUnits relative to the Page.
      Parameters:
      event - the TouchEvent
      pageView - the PageView
      page - the pag
      Returns:
      the touch position in XY Coordinates
    • getMousePointInPageAndGrid

      public static Point2D getMousePointInPageAndGrid(com.google.gwt.event.dom.client.MouseEvent event, Grid grid, PageView pageView, Page page)
      Calculates the MousePosition in DocUnits relative to the Page.
      Parameters:
      event - the MouseEvent
      grid - the grid of the page
      pageView - the PageView
      page - the page
      Returns:
      the mouse position in XY Coordinates
    • getTouchPointInPageAndGrid

      public static Point2D getTouchPointInPageAndGrid(com.google.gwt.event.dom.client.TouchMoveEvent event, Grid grid, PageView pageView, Page page)
      Calculates the TouchPosition in DocUnits relative to the Page and inside the page bounds.
      Parameters:
      event - the TouchEvent
      grid - the grid of the page
      pageView - the PageView
      page - the page
      Returns:
      the touch position in XY Coordinates