summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorHenri Sara <henri.sara@gmail.com>2017-05-30 11:24:38 +0300
committerIlia Motornyi <elmot@vaadin.com>2017-05-30 11:24:38 +0300
commit3217df4491276f5685da2b48bd46624dc5f097b0 (patch)
treea02446774eb6775e3578506294ea71762906d976 /client
parentad31f48b7f395537101a106263897ed3800c61da (diff)
downloadvaadin-framework-3217df4491276f5685da2b48bd46624dc5f097b0.tar.gz
vaadin-framework-3217df4491276f5685da2b48bd46624dc5f097b0.zip
Add since tags and javadocs
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/WidgetUtil.java20
1 files changed, 20 insertions, 0 deletions
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;