protected void onTargetMouseOver(MouseOverEvent event) {
   Element source = event.getNativeEvent().getEventTarget().cast();
   EventTarget from = event.getNativeEvent().getRelatedEventTarget();
   if (from == null || !source.isOrHasChild(from.<Element>cast())) {
     onTargetOver(event.getNativeEvent().<Event>cast());
   }
 }
Esempio n. 2
0
  @Override
  public void onBrowserEvent(Event event) {
    super.onBrowserEvent(event);

    switch (DOM.eventGetType(event)) {
      case Event.ONCONTEXTMENU:
        EventTarget target = event.getEventTarget();

        Element svg = this.getElement().getElementsByTagName("svg").getItem(0);

        if (target.equals(svg)) {
          m_client.getContextMenu().showAt(this, event.getClientX(), event.getClientY());
          event.preventDefault();
          event.stopPropagation();
        }
        break;

      case Event.ONMOUSEDOWN:
        break;

      case Event.ONMOUSEWHEEL:
        double delta = event.getMouseWheelVelocityY() / 30.0;
        double oldScale = m_scale;
        final double newScale = oldScale + delta;
        final int clientX = event.getClientX();
        final int clientY = event.getClientY();
        // broken now need to fix it
        //    	    Command cmd = new Command() {
        //
        //                public void execute() {
        //                    m_client.updateVariable(m_paintableId, "mapScale", newScale, false);
        //                    m_client.updateVariable(m_paintableId, "clientX", clientX, false);
        //                    m_client.updateVariable(m_paintableId, "clientY", clientY, false);
        //
        //                    m_client.sendPendingVariableChanges();
        //                }
        //            };
        //
        //            if(BrowserInfo.get().isWebkit()) {
        //                Scheduler.get().scheduleDeferred(cmd);
        //            }else {
        //                cmd.execute();
        //            }

        break;
    }
  }