diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2008-06-12 13:23:17 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2008-06-12 13:23:17 +0000 |
| commit | e2ebbb4f9c51fd4d4528899b761afe74f6f4dd42 (patch) | |
| tree | cf08b1b3a2d345c346a14a2f203dd0e64cc2f174 /src/live_effects/lpe-mirror_reflect.cpp | |
| parent | Pen context can now wait for a specified number of clicks and finish the path... (diff) | |
| download | inkscape-e2ebbb4f9c51fd4d4528899b761afe74f6f4dd42.tar.gz inkscape-e2ebbb4f9c51fd4d4528899b761afe74f6f4dd42.zip | |
Infrastructure in class LivePathEffect::Effect to put Inkscape into 'wait for parameter path' mode; make LPEMirrorReflect use this to let the user specify the mirroring line
(bzr r5902)
Diffstat (limited to 'src/live_effects/lpe-mirror_reflect.cpp')
| -rw-r--r-- | src/live_effects/lpe-mirror_reflect.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/live_effects/lpe-mirror_reflect.cpp b/src/live_effects/lpe-mirror_reflect.cpp index 438d012db..093841c8d 100644 --- a/src/live_effects/lpe-mirror_reflect.cpp +++ b/src/live_effects/lpe-mirror_reflect.cpp @@ -38,22 +38,20 @@ LPEMirrorReflect::~LPEMirrorReflect() } void -LPEMirrorReflect::doOnApply (SPLPEItem *lpeitem) -{ +LPEMirrorReflect::acceptParamPath (SPPath *param_path) { using namespace Geom; - SPCurve *curve = sp_path_get_curve_for_edit (SP_PATH(lpeitem)); - Point A(curve->first_point().to_2geom()); - Point B(curve->last_point().to_2geom()); - - Point M = (2*A + B)/3; // some point between A and B (a bit closer to A) - Point perp_dir = unit_vector((B - A).ccw()); + SPCurve* curve = sp_path_get_curve_for_edit (param_path); + Geom::Point A(curve->first_point().to_2geom()); + Geom::Point B(curve->last_point().to_2geom()); - Point C(M[X], M[Y] + 150); - Point D(M[X], M[Y] - 150); - - Piecewise<D2<SBasis> > rline = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(C[X], D[X]), Linear(C[Y], D[Y]))); + Piecewise<D2<SBasis> > rline = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(A[X], B[X]), Linear(A[Y], B[Y]))); reflection_line.param_set_and_write_new_value(rline); + + SP_OBJECT(param_path)->deleteObject(true); + + // don't remove this; needed for cleanup tasks + Effect::acceptParamPath(param_path); } std::vector<Geom::Path> |
