Search in sources :

Example 1 with MouseCoordinates

use of org.rstudio.core.client.events.MouseDragHandler.MouseCoordinates in project rstudio by rstudio.

the class SignatureToolTipManager method attachPreviewHandler.

private void attachPreviewHandler() {
    detachPreviewHandler();
    preview_ = Event.addNativePreviewHandler(new NativePreviewHandler() {

        @Override
        public void onPreviewNativeEvent(NativePreviewEvent preview) {
            if (preview.getTypeInt() == Event.ONMOUSEMOVE) {
                NativeEvent event = preview.getNativeEvent();
                coordinates_ = new MouseCoordinates(event.getClientX(), event.getClientY());
                ready_ = true;
            } else if (preview.getTypeInt() == Event.ONKEYDOWN) {
                coordinates_ = null;
                ready_ = true;
                if (preview.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE)
                    suppressed_ = true;
            }
        }
    });
}
Also used : NativePreviewHandler(com.google.gwt.user.client.Event.NativePreviewHandler) NativePreviewEvent(com.google.gwt.user.client.Event.NativePreviewEvent) MouseCoordinates(org.rstudio.core.client.events.MouseDragHandler.MouseCoordinates) NativeEvent(com.google.gwt.dom.client.NativeEvent)

Aggregations

NativeEvent (com.google.gwt.dom.client.NativeEvent)1 NativePreviewEvent (com.google.gwt.user.client.Event.NativePreviewEvent)1 NativePreviewHandler (com.google.gwt.user.client.Event.NativePreviewHandler)1 MouseCoordinates (org.rstudio.core.client.events.MouseDragHandler.MouseCoordinates)1