コード例 #1
0
 public void mouseReleased(MouseEvent e) {
   _mouse_pressed = false;
   _drag_target = null;
   // send target node event first
   Node node = window.findNode(new AminoPoint(e.getPoint().getX(), e.getPoint().getY()));
   // console.log(node);
   MEvent evt = new MEvent();
   evt.node = node;
   evt.x = e.getX();
   evt.y = e.getY();
   if (node != null) {
     Node start = node;
     while (start != null) {
       fireEvent("MOUSE_RELEASE", start, evt);
       if (start.isMouseBlocked()) return;
       start = (Node) start.getParent();
     }
   }
   // send general events next
   fireEvent("MOUSE_RELEASE", null, evt);
 }
コード例 #2
0
    public void mouseDragged(MouseEvent e) {
      if (_mouse_pressed) {
        Node node = window.findNode(new AminoPoint(e.getPoint().getX(), e.getPoint().getY()));
        MEvent evt = new MEvent();

        // redirect events to current drag target, if applicable
        if (_drag_target != null) {
          node = _drag_target;
        }
        evt.node = node;
        evt.x = e.getX();
        evt.y = e.getY();
        if (node != null) {
          Node start = node;
          while (start != null) {
            fireEvent("MOUSE_DRAG", start, evt);
            if (start.isMouseBlocked()) return;
            start = (Node) start.getParent();
          }
        }
        // send general events next
        fireEvent("MOUSE_DRAG", null, evt);
      }
    }