Class Points
java.lang.Object
com.levigo.jadice.web.client.util.helper.Points
Helper Class for points. For angle calculation see
https://coronalabs.com/blog/2013/01/22/implementing-pinch-zoom-rotate/
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
angleBetweenPositonVectors
(Point point1, Point point2) Calculates the degrees between two position vectorsstatic double
angleOfPoint
(Point point) Calculates the degrees between (0,0) and the givenPoint
static double
calculateAngle
(Point vec11, Point vec12, Point vec21, Point vec22) Calculates the angle between the two given vectorsstatic Point2D
getMousePoint
(com.google.gwt.event.dom.client.MouseEvent<?> event, PageView pageView, Page page) Calculates the MousePosition in DocUnits relative to the Page.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.static Point2D
getTouchPoint
(com.google.gwt.event.dom.client.TouchEvent<?> event, PageView pageView, Page page) Calculates the TouchPosition in DocUnits relative to the Page.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.
-
Method Details
-
calculateAngle
Calculates the angle between the two given vectors- Parameters:
vec11
- starting point of the first vectorvec12
- end point of the first vectorvec21
- starting point of the second vectorvec22
- end point of the second vector- Returns:
- the angle in degrees
-
angleBetweenPositonVectors
Calculates the degrees between two position vectors- Parameters:
point1
- the first pointpoint2
- the second point- Returns:
- the angle
-
angleOfPoint
Calculates the degrees between (0,0) and the givenPoint
- 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
- theMouseEvent
pageView
- thePageView
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
- theTouchEvent
pageView
- thePageView
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
- theMouseEvent
grid
- the grid of the pagepageView
- thePageView
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
- theTouchEvent
grid
- the grid of the pagepageView
- thePageView
page
- the page- Returns:
- the touch position in XY Coordinates
-