Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30928
Modified Files:
MoveTool.java
Log Message:
repaired tool so that it does not use special variables
Index: MoveTool.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MoveTool.java 19 Aug 2005 09:50:44 -0000 1.3
--- MoveTool.java 25 Aug 2005 09:50:45 -0000 1.4
***************
*** 38,41 ****
--- 38,47 ----
private int moveMode = XY;
+ /** The previous X coordinate */
+ private int lastX = 0;
+
+ /** The previous Y cordinate */
+ private int lastY = 0;
+
/**
* The Constructor
***************
*** 46,49 ****
--- 52,65 ----
}
+ /**
+ * Invoked when a mouse button has been pressed on a component.
+ * @param e The MouseEvent object
+ */
+ protected void pressed(MouseEvent e) {
+ super.pressed(e);
+ lastX = e.getX();
+ lastY = e.getY();
+ }
+
/**
* Invoked when the mouse is held pressed and moved
***************
*** 51,59 ****
*/
protected void dragged(MouseEvent e) {
if (viewType == View.VIEW_3D) {
! int x = e.getX();
! int y = e.getY();
! double deltaX = x - pressPos[0];
! double deltaY = y - pressPos[1];
double[] coords;
if (selectedSurface != null) {
--- 67,75 ----
*/
protected void dragged(MouseEvent e) {
+ int x = e.getX();
+ int y = e.getY();
if (viewType == View.VIEW_3D) {
! double deltaX = x - lastX;
! double deltaY = y - lastY;
double[] coords;
if (selectedSurface != null) {
***************
*** 98,103 ****
}
if (selectedVertex != null) {
- int x = e.getX();
- int y = e.getY();
View view = glv.getView();
double[] coords = view.toCanvasCoords(new double[]{x, y});
--- 114,117 ----
***************
*** 106,113 ****
} else if (selectedSurface != null) {
View view = glv.getView();
- int x = e.getX();
- int y = e.getY();
double[] coordsa = view.toCanvasCoords(new double[]{x, y});
! double[] coordsb = view.toCanvasCoords(new double[]{pressPos[0], pressPos[1]});
double[] delta = new double[] {coordsa[0] - coordsb[0],
coordsa[1] - coordsb[1],
--- 120,125 ----
} else if (selectedSurface != null) {
View view = glv.getView();
double[] coordsa = view.toCanvasCoords(new double[]{x, y});
! double[] coordsb = view.toCanvasCoords(new double[]{lastX, lastY});
double[] delta = new double[] {coordsa[0] - coordsb[0],
coordsa[1] - coordsb[1],
***************
*** 124,131 ****
} else if (selectedEdge != null) {
View view = glv.getView();
- int x = e.getX();
- int y = e.getY();
double[] coordsa = view.toCanvasCoords(new double[]{x, y});
! double[] coordsb = view.toCanvasCoords(new double[]{pressPos[0], pressPos[1]});
double[] delta = new double[] {coordsa[0] - coordsb[0],
coordsa[1] - coordsb[1],
--- 136,141 ----
} else if (selectedEdge != null) {
View view = glv.getView();
double[] coordsa = view.toCanvasCoords(new double[]{x, y});
! double[] coordsb = view.toCanvasCoords(new double[]{lastX, lastY});
double[] delta = new double[] {coordsa[0] - coordsb[0],
coordsa[1] - coordsb[1],
***************
*** 143,148 ****
updateVertex(from, coordsa);
}
! pressPos[0] = e.getX();
! pressPos[1] = e.getY();
}
--- 153,158 ----
updateVertex(from, coordsa);
}
! lastX = x;
! lastY = y;
}
|