Code

2 LPE things:
[inkscape.git] / src / live_effects / lpe-skeletalstrokes.cpp
index 4e8a589ce6355fe2f59e20e31904a1fdc5d3f9c1..162dfe8a460f2b61b42aa7b9424b2151f0f938b7 100644 (file)
@@ -59,14 +59,10 @@ static const Util::EnumDataConverter<SkelCopyType> SkelCopyTypeConverter(SkelCop
 LPESkeletalStrokes::LPESkeletalStrokes(LivePathEffectObject *lpeobject) :\r
     Effect(lpeobject),\r
     pattern(_("Pattern"), _("Path to put along path"), "pattern", &wr, this, "M0,0 L1,1"),\r
-    origin(_("Origin"), _("Startpoint of the pattern path to put along path"), "origin", &wr, this, Geom::Point(0,0)),\r
     copytype(_("Copytype"), _("How to shape the pattern path along the path"), "copytype", SkelCopyTypeConverter, &wr, this, SSCT_SINGLE_STRETCHED)\r
 {\r
-    registerParameter( dynamic_cast<Parameter *>(&origin) );\r
     registerParameter( dynamic_cast<Parameter *>(&pattern) );\r
     registerParameter( dynamic_cast<Parameter *>(&copytype) );\r
-\r
-    pattern.signal_path_pasted.connect(sigc::mem_fun(*this, &LPESkeletalStrokes::on_pattern_pasted));\r
 }\r
 \r
 LPESkeletalStrokes::~LPESkeletalStrokes()\r
@@ -91,9 +87,13 @@ LPESkeletalStrokes::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in
     n = force_continuity(remove_short_cuts(n,.1));\r
 \r
     D2<Piecewise<SBasis> > patternd2 = make_cuts_independant(pattern);\r
-    Piecewise<SBasis> x=Piecewise<SBasis>(patternd2[0]-origin[0]);\r
-    Piecewise<SBasis> y=Piecewise<SBasis>(patternd2[1]-origin[1]);\r
+    Piecewise<SBasis> x=Piecewise<SBasis>(patternd2[0]);\r
+    Piecewise<SBasis> y=Piecewise<SBasis>(patternd2[1]);\r
     Interval pattBnds = bounds_exact(x);\r
+    x -= pattBnds.min();\r
+    Interval pattBndsY = bounds_exact(y);\r
+    y -= (pattBndsY.max()+pattBndsY.min())/2;\r
+\r
 \r
     int nbCopies = int(uskeleton.cuts.back()/pattBnds.extent());\r
     double scaling = 1;\r
@@ -121,7 +121,6 @@ LPESkeletalStrokes::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in
 \r
     double pattWidth = pattBnds.extent() * scaling;\r
 \r
-    x-=pattBnds.min();\r
     if (scaling != 1)\r
         x*=scaling;\r
 \r
@@ -134,14 +133,6 @@ LPESkeletalStrokes::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in
     return output;\r
 }\r
 \r
-void\r
-LPESkeletalStrokes::on_pattern_pasted()\r
-{\r
-    // a new pattern was pasted through the dialog.  overwrite the origin thingie to the first point of the path\r
-    origin.param_setValue(pattern.valueAt(0));\r
-}\r
-\r
-\r
 \r
 } // namespace LivePathEffect\r
 } /* namespace Inkscape */\r