X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fknotholder.cpp;h=45cb140c019883787c478e928668a85c73511fd7;hb=94d56a52b13080070ff669dad70d404ecc53c68e;hp=629aa73684a3924d3202912261a7bf929631dc24;hpb=41cb516a78b9e54daf81ca4a7e7fc55164c03dfa;p=inkscape.git diff --git a/src/knotholder.cpp b/src/knotholder.cpp index 629aa7368..45cb140c0 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -30,10 +30,12 @@ #include "sp-pattern.h" #include "style.h" #include "live_effects/lpeobject.h" +#include "live_effects/effect.h" +#include "desktop.h" +#include "display/sp-canvas.h" #include "xml/repr.h" // for debugging only -#include #include class SPDesktop; @@ -54,6 +56,8 @@ KnotHolder::KnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFun this->repr = repr; this->local_change = FALSE; + + this->dragging = false; } KnotHolder::~KnotHolder() { @@ -79,7 +83,7 @@ KnotHolder::~KnotHolder() { void KnotHolder::update_knots() { - NR::Matrix const i2d(from_2geom(sp_item_i2d_affine(item))); + Geom::Matrix const i2d(sp_item_i2d_affine(item)); for(std::list::iterator i = entity.begin(); i != entity.end(); ++i) { KnotHolderEntity *e = *i; @@ -90,7 +94,7 @@ KnotHolder::update_knots() void KnotHolder::knot_clicked_handler(SPKnot *knot, guint state) { - KnotHolder *knot_holder = this; + KnotHolder *knot_holder = this; for(std::list::iterator i = knot_holder->entity.begin(); i != knot_holder->entity.end(); ++i) { KnotHolderEntity *e = *i; @@ -134,14 +138,18 @@ KnotHolder::knot_clicked_handler(SPKnot *knot, guint state) void KnotHolder::knot_moved_handler(SPKnot *knot, Geom::Point const &p, guint state) { - // this was a local change and the knotholder does not need to be recreated: + if (this->dragging == false) { + this->dragging = true; + } + + // this was a local change and the knotholder does not need to be recreated: this->local_change = TRUE; for(std::list::iterator i = this->entity.begin(); i != this->entity.end(); ++i) { KnotHolderEntity *e = *i; if (e->knot == knot) { - NR::Point const q = p / from_2geom(sp_item_i2d_affine(item)); - e->knot_set(q, e->knot->drag_origin / from_2geom(sp_item_i2d_affine(item)), state); + Geom::Point const q = p * sp_item_i2d_affine(item).inverse(); + e->knot_set(q, e->knot->drag_origin * sp_item_i2d_affine(item).inverse(), state); break; } } @@ -156,7 +164,9 @@ KnotHolder::knot_moved_handler(SPKnot *knot, Geom::Point const &p, guint state) void KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/) { - if (this->released) { + this->dragging = false; + + if (this->released) { this->released(this->item); } else { SPObject *object = (SPObject *) this->item; @@ -225,7 +235,7 @@ KnotHolder::add_pattern_knotholder() _("Move the pattern fill inside the object"), SP_KNOT_SHAPE_CROSS); entity_scale->create(desktop, item, this, - _("Scale the pattern fill uniformly"), + _("Scale the pattern fill; uniformly if with Ctrl"), SP_KNOT_SHAPE_SQUARE, SP_KNOT_MODE_XOR); entity_angle->create(desktop, item, this, _("Rotate the pattern fill; with Ctrl to snap angle"),