aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2010-02-02 15:30:41 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2010-02-02 15:30:41 +0000
commit3ced8bebfd472f30a870e8190fa8133b714cd0ba (patch)
tree1c306030769a0883dc514c62a258f45c79a9af39
parente5b48f84dfd032c7abb0c00163bafd7ac1005c2d (diff)
downloadvaadin-framework-3ced8bebfd472f30a870e8190fa8133b714cd0ba.tar.gz
vaadin-framework-3ced8bebfd472f30a870e8190fa8133b714cd0ba.zip
fixes issue when drag image is under cursor and using lazy start
svn changeset:11111/svn branch:6.3_dd
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java49
1 files changed, 42 insertions, 7 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java
index 8dab257e29..ed9804b0ed 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java
@@ -2,6 +2,7 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
+import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Position;
@@ -68,14 +69,12 @@ public class VDragAndDropManager {
// pretty much all events are mousemove althout below
// kind of happens mouseover
switch (typeInt) {
- case Event.ONMOUSEOVER:
case Event.ONMOUSEOUT:
+ case Event.ONMOUSEOVER:
ApplicationConnection
.getConsole()
.log(
"IGNORING proxy image event, fired because of hack or not significant");
- // TODO consider if mouseover should actually do
- // same as mouse move.
return;
case Event.ONMOUSEMOVE:
VDropHandler findDragTarget = findDragTarget(targetElement);
@@ -97,8 +96,8 @@ public class VDragAndDropManager {
.setElementOver((com.google.gwt.user.client.Element) targetElement);
currentDropHandler.dragOver(currentDrag);
}
- nativeEvent.preventDefault(); // prevent text
- // selection on IE
+ // prevent text selection on IE
+ nativeEvent.preventDefault();
return;
default:
// just update element over and let the actual
@@ -128,6 +127,7 @@ public class VDragAndDropManager {
target.dragEnter(currentDrag);
} else if (target == null && currentDropHandler != null) {
ApplicationConnection.getConsole().log("Invalid state!?");
+ currentDropHandler.dragLeave(currentDrag);
currentDropHandler = null;
}
break;
@@ -280,26 +280,61 @@ public class VDragAndDropManager {
NativePreviewEvent event) {
int typeInt = event.getTypeInt();
switch (typeInt) {
+ case Event.ONMOUSEOVER:
+ if (typeInt == Event.ONMOUSEOVER) {
+ if (dragElement == null
+ || !dragElement
+ .isOrHasChild((Node) event
+ .getNativeEvent()
+ .getCurrentEventTarget()
+ .cast())) {
+ // drag image appeared below, ignore
+ ApplicationConnection.getConsole()
+ .log("Drag image appeared");
+ break;
+ }
+ }
case Event.ONKEYDOWN:
case Event.ONKEYPRESS:
case Event.ONKEYUP:
// don't cancel possible drag start
break;
+ case Event.ONMOUSEOUT:
+
+ if (dragElement == null
+ || !dragElement
+ .isOrHasChild((Node) event
+ .getNativeEvent()
+ .getRelatedEventTarget()
+ .cast())) {
+ // drag image appeared below, ignore
+ ApplicationConnection.getConsole().log(
+ "Drag image appeared");
+ break;
+ }
case Event.ONMOUSEMOVE:
- deferredStartRegistration.removeHandler();
- deferredStartRegistration = null;
updateCurrentEvent(event.getNativeEvent());
startDrag.execute();
+ break;
default:
// on any other events, clean up the
// deferred drag start
+ ApplicationConnection.getConsole().log(
+ "Drag did not start due event"
+ + event.getNativeEvent()
+ .getType());
deferredStartRegistration.removeHandler();
deferredStartRegistration = null;
+ if (dragElement != null) {
+ RootPanel.getBodyElement().removeChild(
+ dragElement);
+ }
break;
}
}
+
});
} else {