summaryrefslogtreecommitdiffstats
path: root/src/live_effects/lpe-ruler.cpp
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2017-09-16 21:40:25 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2017-09-16 21:40:25 +0000
commitb715d8f04c609173b2e9600660e22fc00f9d328f (patch)
tree98d0c143e3784c4b9bbcb59af40d10dfbeaed7cf /src/live_effects/lpe-ruler.cpp
parentFix bug #1658855, bend from clipboard end point get some spike (diff)
downloadinkscape-b715d8f04c609173b2e9600660e22fc00f9d328f.tar.gz
inkscape-b715d8f04c609173b2e9600660e22fc00f9d328f.zip
Fix bug #1460858 Ruler LPE does not consider drawing scale (page size / viewBox)
Diffstat (limited to 'src/live_effects/lpe-ruler.cpp')
-rw-r--r--src/live_effects/lpe-ruler.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/live_effects/lpe-ruler.cpp b/src/live_effects/lpe-ruler.cpp
index 852592219..7ba5a7913 100644
--- a/src/live_effects/lpe-ruler.cpp
+++ b/src/live_effects/lpe-ruler.cpp
@@ -78,9 +78,12 @@ LPERuler::ruler_mark(Geom::Point const &A, Geom::Point const &n, MarkType const
using namespace Geom;
double real_mark_length = mark_length;
- real_mark_length = Inkscape::Util::Quantity::convert(real_mark_length, unit.get_abbreviation(), "px");
+ SPDocument * document = SP_ACTIVE_DOCUMENT;
+ SPNamedView *nv = sp_document_namedview(document, NULL);
+ Glib::ustring display_unit = nv->display_units->abbr;
+ real_mark_length = Inkscape::Util::Quantity::convert(real_mark_length, unit.get_abbreviation(), display_unit.c_str());
double real_minor_mark_length = minor_mark_length;
- real_minor_mark_length = Inkscape::Util::Quantity::convert(real_minor_mark_length, unit.get_abbreviation(), "px");
+ real_minor_mark_length = Inkscape::Util::Quantity::convert(real_minor_mark_length, unit.get_abbreviation(), display_unit.c_str());
n_major = real_mark_length * n;
n_minor = real_minor_mark_length * n;
@@ -130,10 +133,13 @@ LPERuler::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_i
std::vector<double> s_cuts;
double real_mark_distance = mark_distance;
- real_mark_distance = Inkscape::Util::Quantity::convert(real_mark_distance, unit.get_abbreviation(), "px");
+ SPDocument * document = SP_ACTIVE_DOCUMENT;
+ SPNamedView *nv = sp_document_namedview(document, NULL);
+ Glib::ustring display_unit = nv->display_units->abbr;
+ real_mark_distance = Inkscape::Util::Quantity::convert(real_mark_distance, unit.get_abbreviation(), display_unit.c_str());
double real_offset = offset;
- real_offset = Inkscape::Util::Quantity::convert(real_offset, unit.get_abbreviation(), "px");
+ real_offset = Inkscape::Util::Quantity::convert(real_offset, unit.get_abbreviation(), display_unit.c_str());
for (double s = real_offset; s<totlength; s+=real_mark_distance){
s_cuts.push_back(s);
}