From: cilix42 Date: Wed, 30 Jul 2008 11:29:49 +0000 (+0000) Subject: Add default mirroring line to lpe-symmetry because the on-canvas clicks seem more... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3c65dcac55cc5df9d7d501abaeaa0e7c456727ec;p=inkscape.git Add default mirroring line to lpe-symmetry because the on-canvas clicks seem more difficult to discover --- diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index 39d3bfe30..a70ab507f 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -38,24 +38,23 @@ LPEMirrorSymmetry::LPEMirrorSymmetry(LivePathEffectObject *lpeobject) : LPEMirrorSymmetry::~LPEMirrorSymmetry() { - } void -LPEMirrorSymmetry::acceptParamPath (SPPath *param_path) { +LPEMirrorSymmetry::doOnApply (SPLPEItem *lpeitem) +{ using namespace Geom; - SPCurve* curve = sp_path_get_curve_for_edit (param_path); - Geom::Point A(curve->first_point()); - Geom::Point B(curve->last_point()); - - Piecewise > rline = Piecewise >(D2(Linear(A[X], B[X]), Linear(A[Y], B[Y]))); - reflection_line.set_new_value( rline, true ); - - SP_OBJECT(param_path)->deleteObject(true); + SPItem *item = SP_ITEM(lpeitem); + Geom::Matrix t = sp_item_i2d_affine(item); + NR::Maybe bbox = item->getBounds(t); - // don't remove this; needed for cleanup tasks - Effect::acceptParamPath(param_path); + Point A(bbox->left(), bbox->bottom()); + Point B(bbox->left(), bbox->top()); + A *= t; + B *= t; + Piecewise > rline = Piecewise >(D2(Linear(A[X], B[X]), Linear(A[Y], B[Y]))); + reflection_line.set_new_value(rline, true); } std::vector @@ -90,8 +89,6 @@ LPEMirrorSymmetry::doEffect_path (std::vector const & path_in) return path_out; } -/* ######################## */ - } //namespace LivePathEffect } /* namespace Inkscape */ diff --git a/src/live_effects/lpe-mirror_symmetry.h b/src/live_effects/lpe-mirror_symmetry.h index 40b0292c4..a37e0d45c 100644 --- a/src/live_effects/lpe-mirror_symmetry.h +++ b/src/live_effects/lpe-mirror_symmetry.h @@ -28,8 +28,7 @@ public: LPEMirrorSymmetry(LivePathEffectObject *lpeobject); virtual ~LPEMirrorSymmetry(); - virtual void acceptParamPath (SPPath *param_path); - virtual int acceptsNumParams() { return 2; } + virtual void doOnApply (SPLPEItem *lpeitem); virtual std::vector doEffect_path (std::vector const & path_in);