示例#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();
      }
    }
  }
示例#2
0
  public void mouseDragged(MouseEvent e) {
    synchronized (futureData) {
      isDragging = true;

      if (!PriorityManager.isHigherPriority(e, futureData)) return;
      registerEventRecieved();

      // Find and store the actor that relates to this drag.
      int x = locator.getTranslatedX(e);
      int y = locator.getTranslatedY(e);
      int button = getButton(e);
      futureData.mouseDragged(x, y, button, dragStartData.getActor());
    }
  }