X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Flive_effects%2Flpe-bendpath.cpp;h=6b9fbbb97eaedb8712735680e297f884ffdb487c;hb=71146abe8aba032d73788a625fee5769a581bd3c;hp=49569d4b52d854ceb5a00566478f25e23b3e08a7;hpb=31e039aa8b8f69e4808dd022183f9a4826b87b5f;p=inkscape.git diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp index 49569d4b5..6b9fbbb97 100644 --- a/src/live_effects/lpe-bendpath.cpp +++ b/src/live_effects/lpe-bendpath.cpp @@ -12,9 +12,7 @@ #include "sp-item.h" #include "sp-path.h" #include "sp-item-group.h" -#include "display/curve.h" -#include -#include +//#include #include "libnr/n-art-bpath-2geom.h" #include "svg/svg.h" #include "ui/widget/scalar.h" @@ -86,21 +84,8 @@ LPEBendPath::doBeforeEffect (SPLPEItem *lpeitem) { groupSpecialBehavior = true; - using namespace Geom; - Piecewise > pwd2; - std::vector temppath; - - recursive_original_bbox(SP_GROUP(lpeitem), pwd2, temppath); - - for (unsigned int i=0; i < temppath.size(); i++) { - pwd2.concat( temppath[i].toPwSb() ); - } - - D2 > d2pw = make_cuts_independant(pwd2); - boundingbox_X = bounds_exact(d2pw[0]); - boundingbox_Y = bounds_exact(d2pw[1]); + original_bbox(lpeitem); } - } Geom::Piecewise > @@ -125,8 +110,8 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise > const & pwd boundingbox_X = bounds_exact(x); boundingbox_Y = bounds_exact(y); } - x-= boundingbox_X.min(); - y-= boundingbox_Y.middle(); + x-= vertical_pattern.get_value() ? boundingbox_Y.min() : boundingbox_X.min(); + y-= vertical_pattern.get_value() ? boundingbox_X.middle() : boundingbox_Y.middle(); double scaling = uskeleton.cuts.back()/boundingbox_X.extent(); @@ -148,43 +133,19 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise > const & pwd void LPEBendPath::resetDefaults(SPItem * item) { - if (SP_IS_PATH(item) || SP_IS_GROUP(item)) - { - // set the bend path to run horizontally in the middle of the bounding box of the original path - using namespace Geom; - Piecewise > pwd2; - std::vector temppath; - - if (SP_IS_PATH(item)) - { - //TODO : this won't work well with LPE stacking - temppath = SVGD_to_2GeomPath( SP_OBJECT_REPR(item)->attribute("inkscape:original-d")); - } - else if (SP_IS_GROUP(item)) - { - recursive_original_bbox(SP_GROUP(item), pwd2, temppath); - } - - for (unsigned int i=0; i < temppath.size(); i++) { - pwd2.concat( temppath[i].toPwSb() ); - } - - D2 > d2pw = make_cuts_independant(pwd2); - boundingbox_X = bounds_exact(d2pw[0]); - boundingbox_Y = bounds_exact(d2pw[1]); - - Point start(boundingbox_X.min(), (boundingbox_Y.max()+boundingbox_Y.min())/2); - Point end(boundingbox_X.max(), (boundingbox_Y.max()+boundingbox_Y.min())/2); - - if ( Geom::are_near(start,end) ) { - end += Point(1.,0.); - } - - Geom::Path path; - path.start( start ); - path.appendNew( end ); - bend_path.param_set_and_write_new_value( path.toPwSb() ); + original_bbox(SP_LPE_ITEM(item)); + + Geom::Point start(boundingbox_X.min(), (boundingbox_Y.max()+boundingbox_Y.min())/2); + Geom::Point end(boundingbox_X.max(), (boundingbox_Y.max()+boundingbox_Y.min())/2); + + if ( Geom::are_near(start,end) ) { + end += Geom::Point(1.,0.); } + + Geom::Path path; + path.start( start ); + path.appendNew( end ); + bend_path.param_set_and_write_new_value( path.toPwSb() ); } void