Code

Connector tool: make connectors avoid the convex hull of shapes.
[inkscape.git] / src / draw-context.cpp
index c86e2cc69826f0ebad07620ebdee98efed572e78..de9a7c7e509f3e3b8b2a1663e2467a46e1aca476 100644 (file)
@@ -26,7 +26,6 @@
 #include <glibmm/i18n.h>
 #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<LPEPatternAlongPath*>(lpe)->pattern.on_paste_button_click();
 
@@ -513,7 +512,7 @@ void spdc_endpoint_snap_rotation(SPEventContext const *const ec, Geom::Point &p,
             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::SNAPSOURCE_HANDLE, Inkscape::Snapper::ConstraintLine(best));
+            m.constrainedSnapReturnByRef( Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g, Inkscape::SNAPSOURCE_HANDLE, Inkscape::Snapper::ConstraintLine(best), false);
             p = from_2geom(pt2g);
         }
     }
@@ -662,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);
@@ -842,7 +841,7 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons
     Inkscape::Preferences *prefs = Inkscape::Preferences::get();
 
     Geom::Matrix const i2d (sp_item_i2d_affine (item));
-    Geom::Point pp = pt * i2d;
+    Geom::Point pp = pt;
     double rad = 0.5 * prefs->getDouble(tool_path + "/dot-size", 3.0);
     if (event_state & GDK_MOD1_MASK) {
         /* TODO: We vary the dot size between 0.5*rad and 1.5*rad, where rad is the dot size
@@ -861,6 +860,7 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons
     sp_repr_set_svg_double (repr, "sodipodi:rx", rad * stroke_width);
     sp_repr_set_svg_double (repr, "sodipodi:ry", rad * stroke_width);
     item->updateRepr();
+    sp_item_set_item_transform(item, i2d.inverse());
 
     sp_desktop_selection(desktop)->set(item);