diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2008-08-11 04:53:15 +0000 |
|---|---|---|
| committer | dvlierop2 <dvlierop2@users.sourceforge.net> | 2008-08-11 04:53:15 +0000 |
| commit | b1597d6f47f64eef7d17b7b614056edd64692130 (patch) | |
| tree | b0f4bbc9d67f2afe50125afe915ec1062c0d6b98 /src/star-context.cpp | |
| parent | patch from bug 169004 (diff) | |
| download | inkscape-b1597d6f47f64eef7d17b7b614056edd64692130.tar.gz inkscape-b1597d6f47f64eef7d17b7b614056edd64692130.zip | |
Move all of the snapper code to 2geom
(bzr r6606)
Diffstat (limited to 'src/star-context.cpp')
| -rw-r--r-- | src/star-context.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/star-context.cpp b/src/star-context.cpp index 2d4d7b415..824fd53a4 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -283,7 +283,9 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent /* Snap center */ SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop, NULL); //null, because we don't have an item yet - m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, sc->center); + Geom::Point pt2g = to_2geom(sc->center); + m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, pt2g); + sc->center = from_2geom(pt2g); sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | @@ -451,24 +453,25 @@ static void sp_star_drag(SPStarContext *sc, NR::Point p, guint state) /* Snap corner point with no constraints */ SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop, sc->item); - m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, p); + Geom::Point pt2g = to_2geom(p); + m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, pt2g); - NR::Point const p0 = sp_desktop_dt2root_xy_point(desktop, sc->center); - NR::Point p1 = sp_desktop_dt2root_xy_point(desktop, p); + Geom::Point const p0 = to_2geom(sp_desktop_dt2root_xy_point(desktop, sc->center)); + Geom::Point const p1 = to_2geom(sp_desktop_dt2root_xy_point(desktop, from_2geom(pt2g))); SPStar *star = SP_STAR(sc->item); double const sides = (gdouble) sc->magnitude; - NR::Point const d = p1 - p0; - NR::Coord const r1 = NR::L2(d); - double arg1 = atan2(d); + Geom::Point const d = p1 - p0; + Geom::Coord const r1 = Geom::L2(d); + double arg1 = atan2(from_2geom(d)); if (state & GDK_CONTROL_MASK) { /* Snap angle */ arg1 = sp_round(arg1, M_PI / snaps); } - sp_star_position_set(star, sc->magnitude, p0, r1, r1 * sc->proportion, + sp_star_position_set(star, sc->magnitude, from_2geom(p0), r1, r1 * sc->proportion, arg1, arg1 + M_PI / sides, sc->isflatsided, sc->rounded, sc->randomized); /* status text */ |
