summaryrefslogtreecommitdiffstats
path: root/src/widgets/stroke-style.cpp
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2018-06-10 20:20:18 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-08-05 00:31:06 +0000
commit850515e890b2bebbac5dcde3b04d3fc0cff52654 (patch)
tree29bf5ff744acaedf5bc3ad5d7c831d6a618d2a71 /src/widgets/stroke-style.cpp
parentAllow inkscape handle units and percent in dasharray and dashoffset. Add pref... (diff)
downloadinkscape-850515e890b2bebbac5dcde3b04d3fc0cff52654.tar.gz
inkscape-850515e890b2bebbac5dcde3b04d3fc0cff52654.zip
Revert changes
Diffstat (limited to 'src/widgets/stroke-style.cpp')
-rw-r--r--src/widgets/stroke-style.cpp40
1 files changed, 6 insertions, 34 deletions
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index 74c5e6efc..3a5abbca4 100644
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -25,8 +25,6 @@
#include "object/sp-rect.h"
#include "object/sp-stop.h"
#include "object/sp-text.h"
-#include "util/units.h"
-#include "inkscape.h"
#include "svg/svg-color.h"
@@ -743,38 +741,15 @@ StrokeStyle::setDashSelectorFromStyle(SPDashSelector *dsel, SPStyle *style)
if (!style->stroke_dasharray.values.empty()) {
double d[64];
size_t len = MIN(style->stroke_dasharray.values.size(), 64);
- SPDocument * document = SP_ACTIVE_DOCUMENT;
- SPNamedView *nv = sp_document_namedview(document, NULL);
- Geom::Rect vbox = document->getViewBox();
- Glib::ustring display_unit = "px";
- if (nv) {
- display_unit = nv->display_units->abbr;
- }
for (unsigned i = 0; i < len; i++) {
- double dash = 0;
- if(style->stroke_dasharray.values[i].unit == SVGLength::NONE) {
- dash = style->stroke_dasharray.values[i].value;
- } else if (style->stroke_dasharray.values[i].unit == SVGLength::PERCENT) {
- dash = vbox.width() * style->stroke_dasharray.values[i].value;
- } else {
- dash = Inkscape::Util::Quantity::convert(style->stroke_dasharray.values[i].computed, "px", display_unit.c_str());
- }
if (style->stroke_width.computed != 0)
- d[i] = dash / style->stroke_width.computed;
+ d[i] = style->stroke_dasharray.values[i] / style->stroke_width.computed;
else
- d[i] = dash; // is there a better thing to do for stroke_width==0?
- }
- double dash_offset = 0;
- if (style->stroke_dashoffset.unit == SVGLength::NONE) {
- dash_offset = style->stroke_dashoffset.value;
- } else if (style->stroke_dashoffset.unit == SVGLength::PERCENT) {
- dash_offset = vbox.width() * style->stroke_dashoffset.value;
- } else {
- dash_offset = Inkscape::Util::Quantity::convert(style->stroke_dashoffset.computed, "px", display_unit.c_str());
+ d[i] = style->stroke_dasharray.values[i]; // is there a better thing to do for stroke_width==0?
}
dsel->set_dash(len, d, style->stroke_width.computed != 0 ?
- dash_offset / style->stroke_width.computed :
- dash_offset);
+ style->stroke_dashoffset.value / style->stroke_width.computed :
+ style->stroke_dashoffset.value);
} else {
dsel->set_dash(0, nullptr, 0.0);
}
@@ -1067,11 +1042,8 @@ StrokeStyle::scaleLine()
}
/* Set dash */
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- gboolean scale = prefs->getBool("/options/dash/scale", true);
- if (scale) {
- setScaledDash(css, ndash, dash, offset, width);
- }
+ setScaledDash(css, ndash, dash, offset, width);
+
sp_desktop_apply_css_recursive ((*i), css, true);
}