Wednesday, January 21, 2015

GWT forward mouse wheel event to underlying element

I have a popup panel which should disappear on mouse wheel and forward the event to the underlying DOM element. I do it like the following:

popupPanel.addDomHandler(new MouseWheelHandler() {          @Override          public void onMouseWheel(final MouseWheelEvent event) {              popupPanel.hide();                // forward mouse wheel event              final Element element = DOMUtil.elementFromPoint(event.getClientX(), event.getClientY());              if (event.getNativeEvent() != null) {                  final NativeEvent nativeEvent = event.getNativeEvent();                  Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {                      @Override                      public void execute() {                          element.dispatchEvent(nativeEvent);                      }                  });              }          }  }, MouseWheelEvent.getType());

The popup panel will hide itself, but scroll event gets lost. I tried to debug it, but without result. Is it possible to implement it some other way?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment