diff options
author | Julien Dramaix <julien.dramaix@gmail.com> | 2012-04-22 14:55:56 +0000 |
---|---|---|
committer | Julien Dramaix <julien.dramaix@gmail.com> | 2012-04-22 14:55:56 +0000 |
commit | d1fb5c77ba944e286e2ac9e061d689bfde02017d (patch) | |
tree | 6c7caa5e52409444e6d13cb01a17d980f89a7a44 | |
parent | 1c1d326dea56666a828169896a6460c115fcb76c (diff) | |
download | gwtquery-d1fb5c77ba944e286e2ac9e061d689bfde02017d.tar.gz gwtquery-d1fb5c77ba944e286e2ac9e061d689bfde02017d.zip |
Touch support. Don't call preventDefault on TouchStart event, otherwise the click event is not triggered at the end.
-rwxr-xr-x | gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java index 1e58a691..8f73c250 100755 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java @@ -20,8 +20,6 @@ import com.google.gwt.query.client.Function; import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.plugins.events.GqEvent;
import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.RootPanel;
/**
* Base class for all plug-in that need to handle some mouse interactions.
@@ -82,12 +80,8 @@ public abstract class MousePlugin extends UiPlugin { }).bind(Event.ONCLICK, getPluginName(), (Object) null, new Function() {
@Override
public boolean f(com.google.gwt.user.client.Event event) {
- if (touchSupported) {
- return true;
- }
-
preventClickEvent |= !mouseClick(e, GqEvent.create(event));
-
+
if (preventClickEvent) {
preventClickEvent = false;
@@ -154,7 +148,9 @@ public abstract class MousePlugin extends UiPlugin { bindOtherEvents(element);
- event.getOriginalEvent().preventDefault();
+ if (!touchSupported){ //click event are not triggered if we call preventDefault on touchstart event.
+ event.getOriginalEvent().preventDefault();
+ }
markEventAsHandled(event);
@@ -218,7 +214,7 @@ public abstract class MousePlugin extends UiPlugin { preventClickEvent = (event.getCurrentEventTarget() == startEvent.getCurrentEventTarget());
mouseStop(element, event);
}
- return false;
+ return true;
}
@@ -314,8 +310,6 @@ public abstract class MousePlugin extends UiPlugin { : Event.ONMOUSEUP | Event.ONMOUSEMOVE;
$(document).as(Events).unbind(events, getPluginName(), null);
-
- RootPanel.get().add(new Label("events : " + events + " unbind"));
}
protected int getClientX(Event e) {
|