public void onClick(InputEventInfo ev) {
   // confirm with the user?
   // get the canvas ID
   long canvasClicked = CCanvasController.getCanvasAtPoint(PieMenu.lastOpenedPosition);
   if (canvasClicked != 0l) {
     CGrid.canvasAction = CGrid.CUT_CANVAS;
     CGrid.getInstance().drawSelectedCell(canvasClicked, ev.getX(), ev.getY());
   }
 }
Beispiel #2
0
  public void actionMouseClicked(InputEventInfo event) {
    if (event.getAction() == InputEventInfo.ACTION_PRESSED) {
      super.onMouseDown();
    } else if (event.getAction() == InputEventInfo.ACTION_RELEASED && isPressed) {
      // Networking.send(CalicoPacket.getPacket(NetworkCommand.CANVAS_REDO, cuid));
      Calico.logger.debug("Pressed Color button " + color.toString());
      CalicoDataStore.PenColor = color;
      CalicoDataStore.LastDrawingColor = color;

      if (CalicoDataStore.Mode != CInputMode.ARROW) CalicoDataStore.set_Mode(CInputMode.EXPERT);
      CCanvasController.redrawMenuBars();
      isPressed = false;
    }
  }
  public void onDragged(InputEventInfo ev) {
    if (mouseDownPoint == null) {
      prevPoint.x = ev.getPoint().x;
      prevPoint.y = ev.getPoint().y;
      mouseDownPoint = ev.getPoint();
      CGroupController.move_start(uuid);
    }

    CGroupController.move(
        uuid, (int) (ev.getPoint().x - prevPoint.x), ev.getPoint().y - prevPoint.y);

    long smallestParent =
        CGroupController.groupdb.get(uuid).calculateParent(ev.getPoint().x, ev.getPoint().y);
    if (smallestParent != BubbleMenu.highlightedParentGroup) {
      if (BubbleMenu.highlightedParentGroup != 0l) {
        CGroupController.groupdb.get(BubbleMenu.highlightedParentGroup).highlight_off();
        CGroupController.groupdb.get(BubbleMenu.highlightedParentGroup).highlight_repaint();
      }
      if (smallestParent != 0l) {
        CGroupController.groupdb.get(smallestParent).highlight_on();
        CGroupController.groupdb.get(smallestParent).highlight_repaint();
      }
      BubbleMenu.highlightedParentGroup = smallestParent;
    }

    /*if ((smallestParent = CGroupController.groupdb.get(guuid).calculateParent(e.getPoint().x, e.getPoint().y)) != 0l)
    {
    	CGroupController.groupdb.get(smallestParent).highlight_on();
    }*/

    prevPoint.x = ev.getPoint().x;
    prevPoint.y = ev.getPoint().y;
    ev.stop();
  }
  public void onPressed(InputEventInfo ev) {
    if (!CGroupController.exists(uuid) || isActive) {
      return;
    }

    isActive = true;

    prevPoint = new Point();

    cuuid = CGroupController.groupdb.get(uuid).getCanvasUID();

    // TranslateMouseListener resizeDragListener = new TranslateMouseListener(canvasUUID, guuid);
    // CCanvasController.canvasdb.get(canvasUUID).addMouseListener(resizeDragListener);
    // CCanvasController.canvasdb.get(canvasUUID).addMouseMotionListener(resizeDragListener);

    // pass click event on to this listener since it will miss it
    // resizeDragListener.mousePressed(ev.getPoint());

    prevPoint.x = 0;
    prevPoint.y = 0;
    mouseDownPoint = null;

    ev.stop();
    BubbleMenu.isPerformingBubbleMenuAction = true;

    System.out.println("CLICKED GROUP MOVE BUTTON");
    // CGroupController.drop(group_uuid);
  }
  public void onReleased(InputEventInfo ev) {
    if (BubbleMenu.highlightedParentGroup != 0l) {
      CGroupController.groupdb.get(BubbleMenu.highlightedParentGroup).highlight_off();
      CGroupController.groupdb.get(BubbleMenu.highlightedParentGroup).highlight_repaint();
      BubbleMenu.highlightedParentGroup = 0l;
    }

    // This threw a null pointer exception for some reason...
    if (mouseDownPoint != null) CGroupController.move_end(this.uuid, ev.getX(), ev.getY());

    // Update the menu location in case it was dropped into a list
    // BubbleMenu.moveIconPositions(CGroupController.groupdb.get(guuid).getBounds());

    ev.stop();
    //			PieMenu.isPerformingPieMenuAction = false;

    if (!CGroupController.groupdb.get(uuid).isPermanent()) {
      // CGroupController.drop(guuid);
    }
    super.onReleased(ev);
    isActive = false;
  }
  public void onReleased(InputEventInfo ev) {
    if (CGroupController.exists(uuid)) {
      CGroupController.set_permanent(uuid, true);
    } else if (CStrokeController.exists(uuid)) {
      long new_uuid = Calico.uuid();
      CStrokeController.makeScrap(uuid, new_uuid);
      CGroupController.set_permanent(new_uuid, true);
    }

    ev.stop();

    Calico.logger.debug("CLICKED GROUP PERM BUTTON");

    isActive = false;
  }
  public void onClick(InputEventInfo ev) {
    CGroupController.rectify(uuid);
    ev.stop();

    Calico.logger.debug("CLICKED GROUP RECTIFY BUTTON");
  }