Sfoglia il codice sorgente

Helper methods for drag

svn changeset:17329/svn branch:6.6
tags/6.7.0.beta1
Matti Tahvonen 13 anni fa
parent
commit
7756ba04dc
1 ha cambiato i file con 32 aggiunte e 0 eliminazioni
  1. 32
    0
      src/com/vaadin/terminal/gwt/client/Util.java

+ 32
- 0
src/com/vaadin/terminal/gwt/client/Util.java Vedi File

@@ -1041,4 +1041,36 @@ public class Util {

}

/**
* A helper method to return the client position from an event. Returns
* position from either first changed touch (if touch event) or from the
* event itself.
*
* @param event
* @return
*/
public static int getTouchOrMouseClientX(Event event) {
if ((event.getTypeInt() & Event.TOUCHEVENTS) > 0) {
return event.getChangedTouches().get(0).getClientX();
} else {
return event.getClientX();
}
}

/**
* A helper method to return the client position from an event. Returns
* position from either first changed touch (if touch event) or from the
* event itself.
*
* @param event
* @return
*/
public static int getTouchOrMouseClientY(Event event) {
if ((event.getTypeInt() & Event.TOUCHEVENTS) > 0) {
return event.getChangedTouches().get(0).getClientY();
} else {
return event.getClientY();
}
}

}

Loading…
Annulla
Salva