summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoreman-mod <>2017-04-15 12:00:25 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2017-04-15 12:00:25 +0000
commite82821c81ea7ba01b3bc0b0b9589a97f1ff23144 (patch)
treecb29afea46a1a71ca31996549d66ab59144c3748 /src
parentfix scrolling on style indicator in statusbar for gtk3 (diff)
downloadinkscape-e82821c81ea7ba01b3bc0b0b9589a97f1ff23144.tar.gz
inkscape-e82821c81ea7ba01b3bc0b0b9589a97f1ff23144.zip
Fix behavior of scroling stroke width statusbar indicator with non-px units
Fixed bugs: - https://launchpad.net/bugs/1671877 (bzr r15622)
Diffstat (limited to 'src')
-rw-r--r--src/ui/widget/selected-style.cpp10
-rw-r--r--src/ui/widget/selected-style.h3
2 files changed, 4 insertions, 9 deletions
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index 0370d55db..65d68195c 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -1380,13 +1380,8 @@ RotateableStrokeWidth::value_adjust(double current, double by, guint /*modifier*
{
double newval;
// by is -1..1
- if (by < 0) {
- // map negative 0..-1 to current..0
- newval = current * (1 + by);
- } else {
- // map positive 0..1 to current..4*current
- newval = current * (1 + by) * (1 + by);
- }
+ double max_f = 50; // maximum width is (current * max_f), minimum - zero
+ newval = current * (std::exp(std::log(max_f-1) * (by+1)) - 1) / (max_f-2);
SPCSSAttr *css = sp_repr_css_attr_new ();
if (final && newval < 1e-6) {
@@ -1394,6 +1389,7 @@ RotateableStrokeWidth::value_adjust(double current, double by, guint /*modifier*
// if it's not final, leave it a chance to increase again (which is not possible with "none")
sp_repr_css_set_property (css, "stroke", "none");
} else {
+ newval = Inkscape::Util::Quantity::convert(newval, parent->_sw_unit, "px");
Inkscape::CSSOStringStream os;
os << newval;
sp_repr_css_set_property (css, "stroke-width", os.str().c_str());
diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h
index efac29f73..065d745f0 100644
--- a/src/ui/widget/selected-style.h
+++ b/src/ui/widget/selected-style.h
@@ -131,6 +131,7 @@ public:
guint _mode[2];
double current_stroke_width;
+ Inkscape::Util::Unit const *_sw_unit; // points to object in UnitTable, do not delete
protected:
SPDesktop *_desktop;
@@ -271,8 +272,6 @@ protected:
void on_popup_preset(int i);
Gtk::MenuItem _popup_sw_remove;
- Inkscape::Util::Unit const *_sw_unit; /// points to object in UnitTable, do not delete
-
void *_drop[2];
bool _dropEnabled[2];
};