Fix rubberbox coordinates
[scilab.git] / scilab / modules / renderer / src / java / org / scilab / modules / renderer / JoGLView / interaction / OnePointRubberBox.java
index 6eba67e..cc2d9c1 100644 (file)
@@ -6,7 +6,7 @@
  * This source file is licensed as described in the file COPYING, which
  * you should have received as part of this distribution.  The terms
  * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
  */
 
 package org.scilab.modules.renderer.JoGLView.interaction;
@@ -34,33 +34,22 @@ public class OnePointRubberBox extends RubberBox implements PointRubberBox {
 
     public OnePointRubberBox(DrawerVisitor drawerVisitor, double initialRect[]) {
         super(drawerVisitor);
-        firstPoint = new Vector3d(initialRect[0], initialRect[1], 0);
+        double[][] factors = axes.getScaleTranslateFactors();
+        firstPoint = new Vector3d(initialRect[0] * factors[0][0] + factors[1][0],
+                initialRect[1] * factors[0][1] + factors[1][1],
+                0);
         secondPoint = firstPoint;
         status = Status.WAIT_POINT_B;
         setEnable(true);
     }
 
-    public double[] getResults() {
-        double result[] = {
-                mouseButton - 1,
-                Math.min(firstPoint.getX(), secondPoint.getX()),
-                Math.max(firstPoint.getY(), secondPoint.getY()),
-                Math.max(firstPoint.getZ(), secondPoint.getZ()),
-                Math.abs(firstPoint.getX() - secondPoint.getX()),
-                Math.abs(firstPoint.getY() - secondPoint.getY()),
-                Math.abs(firstPoint.getZ() - secondPoint.getZ())
-        };
-
-        return result;
-    }
-
     @Override
     public void mouseClicked(MouseEvent e) {
         mouseButton = e.getButton();
         setPointB(e.getPoint());
         process();
         setEnable(false);
-        fireRubberBoxEnd();       
+        fireRubberBoxEnd();
     }
 
     /**
@@ -78,6 +67,6 @@ public class OnePointRubberBox extends RubberBox implements PointRubberBox {
                 return true;
             }
         }
-        return false;  
+        return false;
     }
 }