Commit 6b0e82c7 authored by Nico Mack's avatar Nico Mack

Fixed a scripting issue caused by startAngle property

parent bd9b8337
...@@ -66,6 +66,7 @@ public class Sector extends SelectableCorona { ...@@ -66,6 +66,7 @@ public class Sector extends SelectableCorona {
protected boolean flipTitleByQuadrant; protected boolean flipTitleByQuadrant;
protected boolean wrapToFit; protected boolean wrapToFit;
private double correctedAngle;
// protected TouchManager touchManager; // protected TouchManager touchManager;
protected FontRenderContext renderingContext = new FontRenderContext(null, true, true); protected FontRenderContext renderingContext = new FontRenderContext(null, true, true);
...@@ -164,7 +165,7 @@ public class Sector extends SelectableCorona { ...@@ -164,7 +165,7 @@ public class Sector extends SelectableCorona {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
private boolean isFlipped() { private boolean isFlipped() {
int quadrant = AngleUtils.getQuadrant(Math.toRadians(startAngle)); int quadrant = AngleUtils.getQuadrant(Math.toRadians(correctedAngle));
return flipTitleByQuadrant && ((quadrant == 0) || (quadrant == 1)); return flipTitleByQuadrant && ((quadrant == 0) || (quadrant == 1));
} }
...@@ -183,7 +184,7 @@ public class Sector extends SelectableCorona { ...@@ -183,7 +184,7 @@ public class Sector extends SelectableCorona {
boolean flipped = this.isFlipped(); boolean flipped = this.isFlipped();
for (String line : lines) { for (String line : lines) {
Shape labelPath = TextBaselineUtils.buildCircularBaseline(startAngle, arcSpan, labelRadius, metrics.getAscent(), flipped); Shape labelPath = TextBaselineUtils.buildCircularBaseline(correctedAngle, arcSpan, labelRadius, metrics.getAscent(), flipped);
TextStroke stroke = new TextStroke(line, textFont, false, centered, false); TextStroke stroke = new TextStroke(line, textFont, false, centered, false);
Shape circularText = stroke.createStrokedShape(labelPath); Shape circularText = stroke.createStrokedShape(labelPath);
compound.append(circularText, false); compound.append(circularText, false);
...@@ -235,14 +236,14 @@ public class Sector extends SelectableCorona { ...@@ -235,14 +236,14 @@ public class Sector extends SelectableCorona {
// return angle; // return angle;
startAngle = (int) AngleUtils.moduloThreeSixty(AngleUtils.THREE_SIXTY - startAngle - arcSpan + ((double) gap / 2)); correctedAngle = (int) AngleUtils.moduloThreeSixty(AngleUtils.THREE_SIXTY - startAngle - arcSpan + ((double) gap / 2));
arcSpan -= gap; arcSpan -= gap;
// Java Arc3D start angle and extend are expressed in counter clockwise rotation. Since // Java Arc3D start angle and extend are expressed in counter clockwise rotation. Since
// TULIP follows the clockwise TUIO convention, we need to convert both startAngle and // TULIP follows the clockwise TUIO convention, we need to convert both startAngle and
// extend. // extend.
Area pie = new Area(new Arc2D.Double(-outerRadius, -outerRadius, size, size, startAngle, arcSpan, Arc2D.PIE)); Area pie = new Area(new Arc2D.Double(-outerRadius, -outerRadius, size, size, correctedAngle, arcSpan, Arc2D.PIE));
Area hole = new Area(new Ellipse2D.Double(-innerRadius, -innerRadius, innerRadius * 2, innerRadius * 2)); Area hole = new Area(new Ellipse2D.Double(-innerRadius, -innerRadius, innerRadius * 2, innerRadius * 2));
pie.subtract(hole); pie.subtract(hole);
...@@ -313,7 +314,7 @@ public class Sector extends SelectableCorona { ...@@ -313,7 +314,7 @@ public class Sector extends SelectableCorona {
if (!radialLayout) { if (!radialLayout) {
curvedText = this.buildCircularText(lines, metrics); curvedText = this.buildCircularText(lines, metrics);
} else { } else {
curvedText = this.buildRadialText(lines, metrics, startAngle); curvedText = this.buildRadialText(lines, metrics, correctedAngle);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment