* Bug #14540 fixed - Datatips did not clip outside axes bounds 39/18139/4
Caio SOUZA [Thu, 5 May 2016 16:51:08 +0000 (13:51 -0300)]
Fix datatip rendering when it's out ou view box

Change-Id: Ia29fa7a356b2631b435e4aa3cb01711c752a4ea9

scilab/CHANGES
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/DrawerVisitor.java

index c9676f0..df8328d 100644 (file)
@@ -467,7 +467,9 @@ In 6.0.0:
 
 * Bug #14500 fixed - Operator ".^" was broken for sparse matrices.
 
-* Bug #14524 fixed - Numercic locales were not set to standard "C" by default at scilab startup
+* Bug #14540 fixed - Datatips did not clip outside axes bounds
+
+* Bug #14524 fixed - Numeric locales were not set to standard "C" by default at scilab startup
 
 
 In 6.0.0 beta-1:
index be5d6bf..4ca7209 100755 (executable)
@@ -936,14 +936,22 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
         if (datatip.isValid() && datatip.getVisible()) {
             axesDrawer.enableClipping(currentAxes, datatip.getClipProperty());
             try {
-                if (datatip.getMarkMode()) {
-                    /* TODO: appearance can be not-null */
-                    Texture texture = markManager.getMarkSprite(datatip, colorMap, null);
-                    Vector3d markPos = DatatipTextDrawer.calculateAnchorPoint(datatip);
-                    drawingTools.draw(texture, AnchorPosition.CENTER, markPos);
-                }
-                if (datatip.getTipLabelMode()) {
-                    datatipTextDrawer.draw(drawingTools, colorMap, datatip);
+                Double[] box = currentAxes.getCorrectedBounds();
+                Vector3d markPos = DatatipTextDrawer.calculateAnchorPoint(datatip);
+                Double x = markPos.getX();
+                Double y = markPos.getY();
+                Double z = markPos.getZ();
+                if (x >= box[0] && x <= box[1] &&
+                        y >= box[2] && y <= box[3] &&
+                        z >= box[4] && z <= box[5]) {
+                    if (datatip.getMarkMode()) {
+                        /* TODO: appearance can be not-null */
+                        Texture texture = markManager.getMarkSprite(datatip, colorMap, null);
+                        drawingTools.draw(texture, AnchorPosition.CENTER, markPos);
+                    }
+                    if (datatip.getTipLabelMode()) {
+                        datatipTextDrawer.draw(drawingTools, colorMap, datatip);
+                    }
                 }
             } catch (SciRendererException e) {
                 invalidate((Text)datatip, e);