Exemplo n.º 1
0
  public void mouseReleased(MouseEvent e) {
    synchronized (futureData) {
      // This might be the end of a drag
      if (isDragging) {
        // In case we already have a dragEnded and we get another
        // dragEnded, should use the new one
        if (futureData.isMouseDragEnded(null)) {
          futureData = potentialNewDragData;
        }

        if (!PriorityManager.isHigherPriority(e, futureData)) return;
        registerEventRecieved();
        int x = locator.getTranslatedX(e);
        int y = locator.getTranslatedY(e);
        int button = getButton(e);

        Actor clickActor = locator.getTopMostActorAt(e);
        futureData.mouseClicked(x, y, button, 1, clickActor);

        Actor actor = dragStartData.getActor();
        futureData.mouseDragEnded(x, y, button, actor);
        isDragging = false;
        potentialNewDragData = new MouseEventData();
      }
    }
  }
Exemplo n.º 2
0
  public void mouseClicked(MouseEvent e) {
    synchronized (futureData) {
      MouseEventData mouseData = futureData;
      // In case we already have a dragEnded and we get another
      // dragEnded, we need to start collection data for that.
      if (futureData.isMouseDragEnded(null)) {
        mouseData = potentialNewDragData;
      }
      if (!PriorityManager.isHigherPriority(e, mouseData)) return;
      registerEventRecieved();
      Actor actor = locator.getTopMostActorAt(e);
      int x = locator.getTranslatedX(e);
      int y = locator.getTranslatedY(e);
      int button = getButton(e);

      mouseData.mouseClicked(x, y, button, e.getClickCount(), actor);
      isDragging = false;
    }
  }