com.google.gwt.event.dom.client.MouseEvent类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中com.google.gwt.event.dom.client.MouseEvent类的一些代码示例,展示了MouseEvent类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MouseEvent类的具体详情如下:
包路径:com.google.gwt.event.dom.client.MouseEvent
类名称:MouseEvent

MouseEvent介绍

[英]Abstract class representing mouse events.
[中]表示鼠标事件的抽象类。

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Gets the mouse x-position relative to the event's current target element.
 * 
 * @return the relative x-position
 */
public int getX() {
 Element relativeElem = getRelativeElement();
 if (relativeElem != null) {
  return getRelativeX(relativeElem);
 }
 return getClientX();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
  * Gets the mouse y-position relative to the event's current target element.
  * 
  * @return the relative y-position
  */
 public int getY() {
  Element relativeElem = getRelativeElement();
  if (relativeElem != null) {
   return getRelativeY(relativeElem);
  }
  return getClientY();
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Gets the mouse x-position within the browser window's client area.
 * 
 * @return the mouse x-position
 */
public int getClientX() {
 return getNativeEvent().getClientX();
}

代码示例来源:origin: com.ahome-it/lienzo-core

protected AbstractNodeMouseEvent(final T event)
{
  super(event);
  m_x = event.getRelativeX(event.getRelativeElement());
  m_y = event.getRelativeY(event.getRelativeElement());
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-graphicsediting-example-jar

@Override
public Coordinate getScreenCoordinate(MouseEvent<?> event) {
  Element screenElement = mapPresenter.asWidget().getElement();
  return new Coordinate(event.getRelativeX(screenElement), event.getRelativeY(screenElement));
}

代码示例来源:origin: usnistgov/iheos-toolkit2

private void showTooltip(MouseEvent<? extends EventHandler> e, List<String> text, int milliseconds) {
  tooltip.show(e.getClientX() + 20, e.getClientY() + 30, text, milliseconds);
}

代码示例来源:origin: com.ahome-it/lienzo-core

private static boolean isButtonLeft(final MouseEvent<? extends EventHandler> event)
  {
    return event.getNativeButton() == NativeEvent.BUTTON_LEFT;
  }
}

代码示例来源:origin: com.ahome-it/lienzo-core

public void down(final MouseEvent<? extends EventHandler> event)
{
  if ((getSelectionShape() != null) && !m_selectionShapeProvider.isMultipleSelection(event))
  {
    // if the mousedown is any where other than the rectangle, and shift was not held,  clear it.
    // this way, if necessary, a new selection can begin
    final Node<?> node = m_layer.getViewport().findShapeAtPoint(event.getX(), event.getY());
    if (node != getSelectionShape())
    {
      clearIfSelection();
    }
  }
}

代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils

@PatchMethod
static int getY(MouseEvent<?> event) {
  return event.getClientY();
}

代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils

@PatchMethod
static int getX(MouseEvent<?> event) {
  return event.getClientX();
}

代码示例来源:origin: ahome-it/lienzo-core

protected AbstractNodeMouseEvent(final T event)
{
  super(event);
  m_x = event.getRelativeX(event.getRelativeElement());
  m_y = event.getRelativeY(event.getRelativeElement());
}

代码示例来源:origin: fjfd/microscope

end_x = event.getRelativeX(image);
end_y = event.getRelativeY(image);

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-lienzo

private void registerClickHandler() {
  HandlerRegistration registration = text.addNodeMouseClickHandler(event -> {
    if (null != textClickEventViewHandler) {
      eventHandlerManager.get().skipClickHandler();
      final TextClickEvent e = new TextClickEvent(event.getX(),
                            event.getY(),
                            event.getMouseEvent().getClientX(),
                            event.getMouseEvent().getClientY());
      textClickEventViewHandler.handle(e);
      eventHandlerManager.get().restoreClickHandler();
    }
  });
  eventHandlerManager.get().addHandlersRegistration(ViewEventType.TEXT_CLICK,
                           registration);
}

代码示例来源:origin: com.ahome-it/lienzo-core

public static final boolean isButtonLeft(final MouseEvent<?> event)
{
  if (null != event)
  {
    if (event.getNativeButton() == NativeEvent.BUTTON_LEFT)
    {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: ahome-it/lienzo-core

public void down(final MouseEvent<? extends EventHandler> event)
{
  if ((getSelectionShape() != null) && !m_selectionShapeProvider.isMultipleSelection(event))
  {
    // if the mousedown is any where other than the rectangle, and shift was not held,  clear it.
    // this way, if necessary, a new selection can begin
    final Node<?> node = m_layer.getViewport().findShapeAtPoint(event.getX(), event.getY());
    if (node != getSelectionShape())
    {
      clearIfSelection();
    }
  }
}

代码示例来源:origin: gwt-test-utils/gwt-test-utils

@PatchMethod
static int getY(MouseEvent<?> event) {
  return event.getClientY();
}

代码示例来源:origin: gwt-test-utils/gwt-test-utils

@PatchMethod
static int getX(MouseEvent<?> event) {
  return event.getClientX();
}

代码示例来源:origin: ahome-it/lienzo-core

protected AbstractNodeMouseEvent(final T event)
{
  super(event);
  m_x = event.getRelativeX(event.getRelativeElement());
  m_y = event.getRelativeY(event.getRelativeElement());
}

代码示例来源:origin: org.geomajas/geomajas-gwt-client-impl

@Override
public Coordinate getLocation(HumanInputEvent<?> event, RenderSpace renderSpace) {
  switch (renderSpace) {
    case WORLD:
      Coordinate screen = getLocation(event, RenderSpace.SCREEN);
      return mapPresenter.getViewPort().transform(screen, RenderSpace.SCREEN, RenderSpace.WORLD);
    case SCREEN:
    default:
      if (event instanceof MouseEvent<?>) {
        Element element = mapPresenter.asWidget().getElement();
        double offsetX = ((MouseEvent<?>) event).getRelativeX(element);
        double offsetY = ((MouseEvent<?>) event).getRelativeY(element);
        return new Coordinate(offsetX, offsetY);
      } else if (event instanceof TouchEvent<?>) {
        Touch touch = ((TouchEvent<?>) event).getTouches().get(0);
        return new Coordinate(touch.getClientX(), touch.getClientY());
      }
      return new Coordinate(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-lienzo

private void registerDoubleClickHandler() {
  HandlerRegistration registration = text.addNodeMouseDoubleClickHandler(event -> {
    if (null != textDblClickEventViewHandler) {
      eventHandlerManager.get().skipClickHandler();
      final TextDoubleClickEvent e = new TextDoubleClickEvent(event.getX(),
                                  event.getY(),
                                  event.getMouseEvent().getClientX(),
                                  event.getMouseEvent().getClientY());
      textDblClickEventViewHandler.handle(e);
      eventHandlerManager.get().restoreClickHandler();
    }
  });
  eventHandlerManager.get().addHandlersRegistration(ViewEventType.TEXT_DBL_CLICK,
                           registration);
}

相关文章