diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2014-06-16 21:34:16 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2014-06-16 21:34:16 +0000 |
| commit | ba32027677dee7700542b236410411fca62ba9c7 (patch) | |
| tree | 2b35f152c736f51f3899ceb93cef6786c2e4c42a /src | |
| parent | SignalObserver: fix further refcounting issue in signal observer (diff) | |
| download | inkscape-ba32027677dee7700542b236410411fca62ba9c7.tar.gz inkscape-ba32027677dee7700542b236410411fca62ba9c7.zip | |
fixes to LPEKnot, now usable again.
knotholder: if knot coords are non-finite, hide knot. used for hiding the lpeknot switcher knot if there are no crossings
Fixed bugs:
- https://launchpad.net/bugs/781893
(bzr r13428)
Diffstat (limited to 'src')
| -rw-r--r-- | src/knot-holder-entity.cpp | 16 | ||||
| -rw-r--r-- | src/live_effects/lpe-knot.cpp | 24 | ||||
| -rw-r--r-- | src/live_effects/lpe-knot.h | 1 |
3 files changed, 23 insertions, 18 deletions
diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp index 6471124ec..6af5c6a56 100644 --- a/src/knot-holder-entity.cpp +++ b/src/knot-holder-entity.cpp @@ -80,13 +80,17 @@ KnotHolderEntity::~KnotHolderEntity() void KnotHolderEntity::update_knot() { - Geom::Affine const i2dt(item->i2dt_affine()); + Geom::Point knot_pos(knot_get()); + if (knot_pos.isFinite()) { + Geom::Point dp(knot_pos * item->i2dt_affine()); - Geom::Point dp(knot_get() * i2dt); - - _moved_connection.block(); - knot->setPosition(dp, SP_KNOT_STATE_NORMAL); - _moved_connection.unblock(); + _moved_connection.block(); + knot->setPosition(dp, SP_KNOT_STATE_NORMAL); + _moved_connection.unblock(); + } else { + // knot coords are non-finite, hide knot + knot->hide(); + } } Geom::Point diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 581c632f5..cac3a9347 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -353,7 +353,11 @@ LPEKnot::LPEKnot(LivePathEffectObject *lpeobject) : add_other_stroke_width(_("_Crossing path stroke width"), _("Add crossed stroke width to the interruption size"), "add_other_stroke_width", &wr, this, true), switcher_size(_("S_witcher size:"), _("Orientation indicator/switcher size"), "switcher_size", &wr, this, 15), crossing_points_vector(_("Crossing Signs"), _("Crossings signs"), "crossing_points_vector", &wr, this), - gpaths(),gstroke_widths() + crossing_points(), + gpaths(), + gstroke_widths(), + selectedCrossing(0), + switcher(0.,0.) { // register all your parameters here, so Inkscape knows which parameters this effect has: registerParameter( dynamic_cast<Parameter *>(&interruption_width) ); @@ -363,10 +367,6 @@ LPEKnot::LPEKnot(LivePathEffectObject *lpeobject) : registerParameter( dynamic_cast<Parameter *>(&switcher_size) ); registerParameter( dynamic_cast<Parameter *>(&crossing_points_vector) ); - crossing_points = LPEKnotNS::CrossingPoints(); - selectedCrossing = 0; - switcher = Geom::Point(0,0); - _provides_knotholder_entities = true; } @@ -386,9 +386,7 @@ LPEKnot::updateSwitcher(){ //std::cout<<"placing switcher at "<<switcher<<" \n"; }else{ //std::cout<<"hiding switcher!\n"; - //TODO: is there a way to properly hide the helper. - //switcher = Geom::Point(Geom::infinity(),Geom::infinity()); - switcher = Geom::Point(1e10,1e10); + switcher = Geom::Point(Geom::infinity(),Geom::infinity()); } } @@ -539,8 +537,9 @@ LPEKnot::doBeforeEffect (SPLPEItem const* lpeitem) using namespace Geom; original_bbox(lpeitem); - gpaths = std::vector<Geom::Path>(); - gstroke_widths = std::vector<double>(); + gpaths.clear(); + gstroke_widths.clear(); + collectPathsAndWidths(lpeitem, gpaths, gstroke_widths); // std::cout<<"\nPaths on input:\n"; @@ -586,7 +585,10 @@ LPEKnot::doBeforeEffect (SPLPEItem const* lpeitem) // std::cout<<crossing_points[toto].sign<<"),"; // } crossing_points.inherit_signs(old_crdata); - crossing_points_vector.param_set_and_write_new_value(crossing_points.to_vector()); + + // Don't write to XML here, only store it in the param itself. Will be written to SVG later + crossing_points_vector.param_setValue(crossing_points.to_vector()); + updateSwitcher(); } diff --git a/src/live_effects/lpe-knot.h b/src/live_effects/lpe-knot.h index b937f9021..f926bf085 100644 --- a/src/live_effects/lpe-knot.h +++ b/src/live_effects/lpe-knot.h @@ -74,7 +74,6 @@ private: BoolParam add_stroke_width; BoolParam add_other_stroke_width; ScalarParam switcher_size; - double stroke_width; ArrayParam<double> crossing_points_vector;//svg storage of crossing_points LPEKnotNS::CrossingPoints crossing_points;//topology representation of the knot. |
