Ejemplo n.º 1
0
  @Override
  public void mouseClicked(MouseEvent e) {
    IFormeEditable courbePrecSelect = null;
    if (this.pan.getFormeSelectionnee() != null) courbePrecSelect = this.pan.getFormeSelectionnee();

    if (SwingUtilities.isRightMouseButton(e)) Action.selectionner(this.pan, e.getX(), e.getY());

    switch (Action.getActionCourante()) {
      case Action.AJOUTER:
        if (SwingUtilities.isLeftMouseButton(e)) Action.ajouter(this.pan, e.getX(), e.getY());
        break;
      case Action.COMBINER:
        if (SwingUtilities.isRightMouseButton(e))
          Action.combiner(courbePrecSelect, this.pan.getFormeSelectionnee());
        break;
      case Action.SUPPRIMER:
        if (SwingUtilities.isLeftMouseButton(e)) Action.supprimer(pan);
        break;
      case Action.ROTATION:
        if (SwingUtilities.isLeftMouseButton(e))
          Action.deplacer(this.pan.getFormeSelectionnee().getCentreRot(), e.getX(), e.getY());
        break;
    }

    this.pan.repaint();
  }
Ejemplo n.º 2
0
  @Override
  public void mouseDragged(MouseEvent e) {
    this.nouvPos = new Point2D(e.getX(), e.getY());

    switch (Action.getActionCourante()) {
      case Action.DEPLACER:
        if (SwingUtilities.isLeftMouseButton(e))
          Action.deplacer(this.pan.getFormeSelectionnee(), e.getX(), e.getY());
        break;
      case Action.ROTATION:
        if (SwingUtilities.isLeftMouseButton(e))
          Action.rotation(
              this.pan.getFormeSelectionnee().getCentreRot(),
              this.pan.getFormeSelectionnee(),
              this.nouvPos,
              this.anciennePos);
        break;
    }

    this.pan.repaint();

    this.anciennePos = new Point2D(this.nouvPos);
  }