summaryrefslogtreecommitdiffstats
path: root/src/measure-context.cpp
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2012-06-08 15:23:34 +0000
committerJon A. Cruz <jon@joncruz.org>2012-06-08 15:23:34 +0000
commit277db7db94ce70f1642b7ad16d138f114c76310b (patch)
tree03b286c0c38d15ff81bc990df5493ea89ad16417 /src/measure-context.cpp
parentImprove approach for keeping angle display string visible. (diff)
downloadinkscape-277db7db94ce70f1642b7ad16d138f114c76310b.tar.gz
inkscape-277db7db94ce70f1642b7ad16d138f114c76310b.zip
Move measure angle string to keep it visible when angle is small.
(bzr r11469)
Diffstat (limited to 'src/measure-context.cpp')
-rw-r--r--src/measure-context.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/measure-context.cpp b/src/measure-context.cpp
index 33650d8dd..a3ff816c3 100644
--- a/src/measure-context.cpp
+++ b/src/measure-context.cpp
@@ -181,6 +181,12 @@ Geom::Point calcAngleDisplayAnchor(SPDesktop *desktop, double angle, double base
Geom::Point where(lengthVal, 0);
where *= Geom::Affine(Geom::Rotate(effective)) * Geom::Affine(Geom::Translate(startPoint));
+ // When the angle is tight, the label would end up under the cursor and/or lines. Bump it
+ double scaledFontsize = std::abs(fontsize * desktop->w2d(Geom::Point(0, 1.0))[Geom::Y]);
+ if (std::abs((where - endPoint).length()) < scaledFontsize) {
+ where[Geom::Y] += scaledFontsize * 2;
+ }
+
// We now have the ideal position, but need to see if it will fit/work.
Geom::Rect visibleArea = desktop->get_display_area();