summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/pencil-tool.cpp
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2017-12-26 16:14:27 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2017-12-26 16:14:27 +0000
commitd25de3679d94cc03fdba8aba4de20fab723b4b27 (patch)
treeb5f7a1fea6f2bb2f0d3069916b023ca8b4fa325b /src/ui/tools/pencil-tool.cpp
parentMerge branch 'master' into powerpencilII (diff)
downloadinkscape-d25de3679d94cc03fdba8aba4de20fab723b4b27.tar.gz
inkscape-d25de3679d94cc03fdba8aba4de20fab723b4b27.zip
Fix power stroke closed path and minor tweacks for pencil powerstroke
Diffstat (limited to 'src/ui/tools/pencil-tool.cpp')
-rw-r--r--src/ui/tools/pencil-tool.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp
index 8d9981ae2..2f68688a1 100644
--- a/src/ui/tools/pencil-tool.cpp
+++ b/src/ui/tools/pencil-tool.cpp
@@ -771,7 +771,7 @@ PencilTool::addPowerStrokePencil()
{
using namespace Inkscape::LivePathEffect;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- double step = prefs->getIntLimited("/tools/freehand/pencil/ps-step-pressure",10, 1, 100)/100.0;
+ double step = prefs->getIntLimited("/tools/freehand/pencil/ps-step-pressure",5, 1, 100)/100.0;
double min = prefs->getIntLimited("/tools/freehand/pencil/minpressure", 0, 1, 100) / 100.0;
double max = prefs->getIntLimited("/tools/freehand/pencil/maxpressure", 100, 1, 100) / 100.0;
Geom::Affine transform_coordinate = SP_ITEM(SP_ACTIVE_DESKTOP->currentLayer())->i2dt_affine();
@@ -790,11 +790,16 @@ PencilTool::addPowerStrokePencil()
double dezoomify_factor = 0.05 * 1000/SP_EVENT_CONTEXT(this)->desktop->current_zoom();//\/100 we want 100% = 1;
double last_pressure = this->_wps.back();
double pressure_shrunk = (last_pressure * (max - min)) + min;
+ step = (step * (max - min)) + min;
//We need half width for power stroke
double pressure_computed = pressure_shrunk * dezoomify_factor/2.0;
this->_last_point = this->ps.back();
this->_last_point *= transform_coordinate.inverse();
- if (this->ps.size() == 1 || std::abs(_previous_pressure - pressure_shrunk) > step ) {
+ if (this->ps.size() == 1 ||
+ std::abs(_previous_pressure - pressure_shrunk) > step ||
+ _previous_pressure == 0.0 ||
+ (_previous_pressure > step && pressure_shrunk < step))
+ {
_previous_pressure = pressure_shrunk;
this->points.push_back(Geom::Point(0, pressure_computed));
this->_points_pos.push_back(this->_last_point);