From 3217df4491276f5685da2b48bd46624dc5f097b0 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Tue, 30 May 2017 11:24:38 +0300 Subject: Add since tags and javadocs --- .../src/main/java/com/vaadin/client/WidgetUtil.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'client/src') diff --git a/client/src/main/java/com/vaadin/client/WidgetUtil.java b/client/src/main/java/com/vaadin/client/WidgetUtil.java index 59fc922d82..817de00f66 100644 --- a/client/src/main/java/com/vaadin/client/WidgetUtil.java +++ b/client/src/main/java/com/vaadin/client/WidgetUtil.java @@ -1832,11 +1832,31 @@ public class WidgetUtil { return integerPart + ((int) nrFractions) / divisor; } + /** + * Returns the X coordinate of an event relative to an element. + * + * @param element + * base element of the relative coordinates + * @param event + * with touch or mouse coordinates + * @return relative X coordinate + * @since 8.1 + */ public static int getRelativeX(Element element, NativeEvent event) { int relativeLeft = element.getAbsoluteLeft() - Window.getScrollLeft(); return WidgetUtil.getTouchOrMouseClientX(event) - relativeLeft; } + /** + * Returns the Y coordinate of an event relative to an element. + * + * @param element + * base element of the relative coordinates + * @param event + * with touch or mouse coordinates + * @return relative Y coordinate + * @since 8.1 + */ public static int getRelativeY(Element element, NativeEvent event) { int relativeTop = element.getAbsoluteTop() - Window.getScrollTop(); return WidgetUtil.getTouchOrMouseClientY(event) - relativeTop; -- cgit v1.2.3