mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
keep label oriantation the same between the two modes
This commit is contained in:
@@ -319,11 +319,14 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
Rectangle2D textRect = fontMetrics.getStringBounds(label, g2d);
|
Rectangle2D textRect = fontMetrics.getStringBounds(label, g2d);
|
||||||
// Don't offset in outline mode.
|
// Don't offset in outline mode.
|
||||||
int offset = outlineMode ? 0 : getLabelOffset((int) length, (int) width, (int) textRect.getWidth());
|
int offset = outlineMode ? 0 : getLabelOffset((int) length, (int) width, (int) textRect.getWidth());
|
||||||
|
|
||||||
// Adjust label angle if needed to make sure that it's readable.
|
// Adjust label angle if needed to make sure that it's readable.
|
||||||
if ((theta >= Math.PI / 2 && theta <= Math.PI) || (theta < -Math.PI / 2 && theta > -Math.PI)) {
|
if ((theta >= Math.PI / 2 && theta <= Math.PI) || (theta < -Math.PI / 2 && theta > -Math.PI)) {
|
||||||
g2d.rotate(Math.PI, length / 2, width / 2);
|
g2d.rotate(Math.PI, length / 2, width / 2);
|
||||||
|
theta += Math.PI;
|
||||||
offset = -offset;
|
offset = -offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMoveLabel()) {
|
if (getMoveLabel()) {
|
||||||
g2d.setTransform(oldTransform);
|
g2d.setTransform(oldTransform);
|
||||||
g2d.translate(getNewPoints()[2].x, getNewPoints()[2].y);
|
g2d.translate(getNewPoints()[2].x, getNewPoints()[2].y);
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user