Bug 13280 fixed: Axes not always displayed correctly after resize 08/14108/2
Calixte DENIZET [Mon, 24 Mar 2014 10:55:55 +0000 (11:55 +0100)]
Change-Id: Ie81bf535cc0ac7e4422de59410c9ce288f99837a

scilab/CHANGES_5.5.X
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/DrawerVisitor.java

index 9e8ea9f..3ff81ff 100644 (file)
@@ -793,6 +793,8 @@ Scilab Bug Fixes
 
 * Bug #13271 fixed - plot2d with logarithmic scale and %nan value freezed Scilab.
 
+* Bug #13280 fixed - Axes were not always displayed correctly after figure resizing.
+
 
 Xcos Bug Fixes
 ==============
index 4a467bf..c94ec24 100755 (executable)
@@ -391,10 +391,11 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
         synchronized (figure) {
             /** Set the current {@see ColorMap}. */
             try {
+                Dimension dims = getCanvas().getDimension();
                 colorMap = figure.getColorMap();
                 drawingTools.clear(ColorFactory.createColor(colorMap, figure.getBackground()));
                 drawingTools.clearDepthBuffer();
-                if (figure.isValid() && figure.getVisible() && figure.getImmediateDrawing()) {
+                if (figure.isValid() && figure.getVisible() && figure.getImmediateDrawing() && dims.width > 1 && dims.height > 1) {
                     askAcceptVisitor(figure.getChildren());
                 }
             } catch (Exception e) {
@@ -413,8 +414,11 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
                 if (frame.isValid() && frame.getVisible()) {
                     DrawerVisitor visitor = visitorMap.get(frame.getIdentifier());
                     if (visitor != null) {
+                        Dimension dims = visitor.getCanvas().getDimension();
                         visitor.setDrawingTools(drawingTools);
-                        visitor.askAcceptVisitor(frame.getChildren());
+                        if (dims.width > 1 && dims.height > 1) {
+                            visitor.askAcceptVisitor(frame.getChildren());
+                        }
                     }
                 }
             } catch (Exception e) {
@@ -1028,12 +1032,17 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
             }
 
             if (object instanceof Axes) {
-
                 Axes axes = (Axes) object;
 
                 if ((axes.getXAxisAutoTicks() && X_AXIS_TICKS_PROPERTIES.contains(property)) ||
                         (axes.getYAxisAutoTicks() && Y_AXIS_TICKS_PROPERTIES.contains(property)) ||
                         (axes.getZAxisAutoTicks() && Z_AXIS_TICKS_PROPERTIES.contains(property))) {
+                    return false;
+                }
+
+                if ((!axes.getXAxisAutoTicks() && X_AXIS_TICKS_PROPERTIES.contains(property)) ||
+                        (!axes.getYAxisAutoTicks() && Y_AXIS_TICKS_PROPERTIES.contains(property)) ||
+                        (!axes.getZAxisAutoTicks() && Z_AXIS_TICKS_PROPERTIES.contains(property))) {
                     axesDrawer.computeMargins(axes);
                     return false;
                 }