Bug 13042 fixed: Text in plot were not correctly centered 71/13071/2
Calixte DENIZET [Mon, 4 Nov 2013 11:21:58 +0000 (12:21 +0100)]
Change-Id: I8c83a2c3c131b7afe8093aa0733fc99def68d76d

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

index f723c27..a8e8fc3 100644 (file)
@@ -107,6 +107,8 @@ Scilab Bug Fixes
 
 * Bug #13036 fixed - Help page associated to history browser was wrong.
 
+* Bug #13042 fixed - Texts in graphics were not correctly centered.
+
 * Bug #13047 fixed - jcompile did not allow class reloading.
 
 * Bug #13049 fixed - New handled protocols added in links in SciNotes.
index 686f690..8a6525b 100644 (file)
@@ -183,8 +183,8 @@ public class TextManager {
         textHeight = textHeight.minus(unscaledTextPosition);
 
         if (text.getTextBoxMode() >= 1) {
-            textWidth = textWidth.getNormalized().times(textBox[0]);
-            textHeight = textHeight.getNormalized().times(textBox[1]);
+            textWidth = textWidth.getNormalized().times(textBox[0] * factors[0][0]);
+            textHeight = textHeight.getNormalized().times(textBox[1] * factors[0][1]);
         }
 
         /*
@@ -213,8 +213,8 @@ public class TextManager {
         textWidth = ScaleUtils.applyLogScale(textWidth, logFlags);
         textHeight = ScaleUtils.applyLogScale(textHeight, logFlags);
 
-        textWidth = textWidth.minus(textPosition);
-        textHeight = textHeight.minus(textPosition);
+        textWidth = textWidth.minus(unscaledTextPosition);
+        textHeight = textHeight.minus(unscaledTextPosition);
 
         projTextWidth = projection.projectDirection(textWidth);
         projTextHeight = projection.projectDirection(textHeight);
@@ -298,8 +298,6 @@ public class TextManager {
         cornerPositions[1] = new Vector3d(textPosition);
 
         if (text.getTextBoxMode() >= 1) {
-            Double[] textBox = text.getTextBox();
-
             Vector3d textBoxWidth = new Vector3d(textBoxVectors[0]);
             Vector3d textBoxHeight = new Vector3d(textBoxVectors[1]);
 
@@ -478,7 +476,6 @@ public class TextManager {
         return coordinates;
     }
 
-
     /**
      * Update the data if needed.
      * @param id the modified object.