2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2012 - Scilab Enterprises - Bruno JOFRET
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
12 package org.scilab.modules.renderer.JoGLView.interaction;
14 import java.awt.event.MouseEvent;
16 import org.scilab.modules.renderer.JoGLView.DrawerVisitor;
19 * @author Bruno JOFRET
21 public class DragPointRubberBox extends TwoPointsRubberBox {
24 * Default constructor.
26 * @param drawerVisitor parent drawer visitor.
28 public DragPointRubberBox(DrawerVisitor drawerVisitor) {
33 public final void mouseClicked(MouseEvent e) {
37 public void mousePressed(MouseEvent e) {
38 mouseButton = e.getButton();
41 if (setPointA(e.getPoint())) {
42 status = Status.WAIT_POINT_B;
49 setPointB(e.getPoint());
50 if (pointBComputer.is2D()) {
55 status = Status.WAIT_POINT_C;
59 setPointC(e.getPoint());
60 status = Status.WAIT_POINT_D;
63 setPointD(e.getPoint());
74 public void mouseReleased(MouseEvent e) {
75 mouseButton = e.getButton();
78 if (setPointA(e.getPoint())) {
79 status = Status.WAIT_POINT_B;
86 setPointB(e.getPoint());
87 if (pointBComputer.is2D()) {
92 status = Status.WAIT_POINT_C;
96 setPointC(e.getPoint());
97 status = Status.WAIT_POINT_D;
100 setPointD(e.getPoint());
111 public final void mouseDragged(MouseEvent e) {
114 setPointA(e.getPoint());
115 getDrawerVisitor().getCanvas().redraw();
118 setPointB(e.getPoint());
119 getDrawerVisitor().getCanvas().redraw();
122 setPointC(e.getPoint());
123 getDrawerVisitor().getCanvas().redraw();
126 setPointD(e.getPoint());
127 getDrawerVisitor().getCanvas().redraw();