From e2ebbb4f9c51fd4d4528899b761afe74f6f4dd42 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Thu, 12 Jun 2008 13:23:17 +0000 Subject: 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) --- src/live_effects/lpe-mirror_reflect.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/live_effects/lpe-mirror_reflect.cpp') 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 > rline = Piecewise >(D2(Linear(C[X], D[X]), Linear(C[Y], D[Y]))); + Piecewise > rline = Piecewise >(D2(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 -- cgit v1.2.3