From 093ec0101374a4135540d3e6b0ba4bf1b433ccf1 Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Tue, 29 Jan 2013 17:58:40 +0200 Subject: [PATCH] Merge of (#10507) to Vaadin 7. Consistent element finding for mouseUp and mouseDown handling. Change-Id: I5e7783417cbec99523337a057bd4ececc8f9b0e2 --- .../com/vaadin/client/ui/AbstractClickEventHandler.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/client/src/com/vaadin/client/ui/AbstractClickEventHandler.java b/client/src/com/vaadin/client/ui/AbstractClickEventHandler.java index 823618bd8f..bd2654df75 100644 --- a/client/src/com/vaadin/client/ui/AbstractClickEventHandler.java +++ b/client/src/com/vaadin/client/ui/AbstractClickEventHandler.java @@ -15,7 +15,6 @@ */ package com.vaadin.client.ui; -import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.event.dom.client.ContextMenuEvent; import com.google.gwt.event.dom.client.ContextMenuHandler; @@ -49,7 +48,7 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler, /** * The element where the last mouse down event was registered. */ - private JavaScriptObject lastMouseDownTarget; + private Element lastMouseDownTarget; /** * Set to true by {@link #mouseUpPreviewHandler} if it gets a mouseup at the @@ -75,7 +74,7 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler, Element elementUnderMouse = Util.getElementUnderMouse(event .getNativeEvent()); if (lastMouseDownTarget != null - && elementUnderMouse.cast() == lastMouseDownTarget) { + && elementUnderMouse == lastMouseDownTarget) { mouseUpPreviewMatched = true; } else { System.out.println("Ignoring mouseup from " @@ -172,7 +171,7 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler, * When getting a mousedown event, we must detect where the * corresponding mouseup event if it's on a different part of the page. */ - lastMouseDownTarget = event.getNativeEvent().getEventTarget(); + lastMouseDownTarget = Util.getElementUnderMouse(event.getNativeEvent()); mouseUpPreviewMatched = false; mouseUpEventPreviewRegistration = Event .addNativePreviewHandler(mouseUpPreviewHandler); -- 2.39.5