diff options
| author | Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> | 2019-02-13 12:11:45 +0000 |
|---|---|---|
| committer | Nathan Lee <utasstudent-git1271@yahoo.com> | 2019-02-16 13:41:43 +0000 |
| commit | 6bbeb3d1be7b279c941a500d731f315954ae3f6c (patch) | |
| tree | 399d58947a2cfa70a7a0c28e6a17d45e9b15a82c /src/ui/tools/arc-tool.cpp | |
| parent | Code simplification using InkscapeApplication singleton. (diff) | |
| download | inkscape-6bbeb3d1be7b279c941a500d731f315954ae3f6c.tar.gz inkscape-6bbeb3d1be7b279c941a500d731f315954ae3f6c.zip | |
[Fix 1778449] Correct Ellipse status bar text for golden ratio
Uses code for rectangle constrained at golden ratio from rect-tool.cpp
Fixes https://bugs.launchpad.net/inkscape/+bug/1778449
Diffstat (limited to 'src/ui/tools/arc-tool.cpp')
| -rw-r--r-- | src/ui/tools/arc-tool.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp index bae0b070b..8af5d9a1e 100644 --- a/src/ui/tools/arc-tool.cpp +++ b/src/ui/tools/arc-tool.cpp @@ -392,16 +392,39 @@ void ArcTool::drag(Geom::Point pt, guint state) { if (state & GDK_CONTROL_MASK) { int ratio_x, ratio_y; + bool is_golden_ratio = false; if (fabs (rdimx) > fabs (rdimy)) { + if (fabs(rdimx / rdimy - goldenratio) < 1e-6) { + is_golden_ratio = true; + } + ratio_x = (int) rint (rdimx / rdimy); ratio_y = 1; } else { + if (fabs(rdimy / rdimx - goldenratio) < 1e-6) { + is_golden_ratio = true; + } + ratio_x = 1; ratio_y = (int) rint (rdimy / rdimx); } - this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s × %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"), xs.c_str(), ys.c_str(), ratio_x, ratio_y); + if (!is_golden_ratio) { + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, + _("<b>Ellipse</b>: %s × %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"), + xs.c_str(), ys.c_str(), ratio_x, ratio_y); + } else { + if (ratio_y == 1) { + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, + _("<b>Ellipse</b>: %s × %s (constrained to golden ratio 1.618 : 1); with <b>Shift</b> to draw around the starting point"), + xs.c_str(), ys.c_str()); + } else { + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, + _("<b>Ellipse</b>: %s × %s (constrained to golden ratio 1 : 1.618); with <b>Shift</b> to draw around the starting point"), + xs.c_str(), ys.c_str()); + } + } } else { this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s × %s; with <b>Ctrl</b> to make square or integer-ratio ellipse; with <b>Shift</b> to draw around the starting point"), xs.c_str(), ys.c_str()); } |
