X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fdraw-context.cpp;h=d2794f0c2b6f1eed9e7444f01df145d15eb004a7;hb=55bd061c7024092e719c231150774b7a1d7c60b9;hp=a8d6187f6917908e747b7e87f28afa75cdfc361f;hpb=8d886d1cc0b61079f2dff30edd6ecfca80f32063;p=inkscape.git diff --git a/src/draw-context.cpp b/src/draw-context.cpp index a8d6187f6..d2794f0c2 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -26,7 +26,6 @@ #include #include "display/curve.h" #include "desktop.h" -#include "desktop-affine.h" #include "desktop-handles.h" #include "desktop-style.h" #include "document.h" @@ -304,7 +303,7 @@ spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item) SPCSSAttr *css_item = sp_css_attr_from_object (SP_OBJECT(item), SP_STYLE_FLAG_ALWAYS); const char *cstroke = sp_repr_css_property(css_item, "stroke", "none"); -#define SHAPE_LENGTH 100 +#define SHAPE_LENGTH 10 #define SHAPE_HEIGHT 10 switch (shape) { @@ -360,7 +359,7 @@ spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item) case 4: { // take shape from clipboard; TODO: catch the case where clipboard is empty - Effect::createAndApply(FREEHAND_SHAPE, dc->desktop->doc(), item); + Effect::createAndApply(PATTERN_ALONG_PATH, dc->desktop->doc(), item); Effect* lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item)); static_cast(lpe)->pattern.on_paste_button_click(); @@ -507,13 +506,13 @@ void spdc_endpoint_snap_rotation(SPEventContext const *const ec, Geom::Point &p, p = o + bdot * best; if (!(state & GDK_SHIFT_MASK)) { //SHIFT disables all snapping, except the angular snapping above - //After all, the user explicitely asked for angular snapping by + //After all, the user explicitly asked for angular snapping by //pressing CTRL /* Snap it along best vector */ SnapManager &m = SP_EVENT_CONTEXT_DESKTOP(ec)->namedview->snap_manager; m.setup(SP_EVENT_CONTEXT_DESKTOP(ec)); Geom::Point pt2g = to_2geom(p); - m.constrainedSnapReturnByRef( Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g, Inkscape::Snapper::ConstraintLine(best)); + m.constrainedSnapReturnByRef( Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g, Inkscape::SNAPSOURCE_HANDLE, Inkscape::Snapper::ConstraintLine(best), false); p = from_2geom(pt2g); } } @@ -522,10 +521,16 @@ void spdc_endpoint_snap_rotation(SPEventContext const *const ec, Geom::Point &p, void spdc_endpoint_snap_free(SPEventContext const * const ec, Geom::Point& p, guint const /*state*/) { - SnapManager &m = SP_EVENT_CONTEXT_DESKTOP(ec)->namedview->snap_manager; - m.setup(SP_EVENT_CONTEXT_DESKTOP(ec)); + SPDesktop *dt = SP_EVENT_CONTEXT_DESKTOP(ec); + SnapManager &m = dt->namedview->snap_manager; + Inkscape::Selection *selection = sp_desktop_selection (dt); + + // selection->singleItem() is the item that is currently being drawn. This item will not be snapped to (to avoid self-snapping) + // TODO: Allow snapping to the stationary parts of the item, and only ignore the last segment + + m.setup(dt, true, selection->singleItem()); Geom::Point pt2g = to_2geom(p); - m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g); + m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g, Inkscape::SNAPSOURCE_HANDLE); p = from_2geom(pt2g); } @@ -656,7 +661,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc) /* Now we have to go back to item coordinates at last */ c->transform( dc->white_item ? sp_item_dt2i_affine(dc->white_item) - : to_2geom(sp_desktop_dt2doc_affine(SP_EVENT_CONTEXT_DESKTOP(dc))) ); + : SP_EVENT_CONTEXT_DESKTOP(dc)->dt2doc() ); SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc); SPDocument *doc = sp_desktop_document(desktop);