From 5a006c04acbdc0ef7f0ec17df5555f52355cf598 Mon Sep 17 00:00:00 2001 From: cilix42 Date: Wed, 25 Apr 2007 22:59:03 +0000 Subject: [PATCH] In node tool: make rotation by [] and scaling by <> also use the active node as center (if there is one) --- src/nodepath.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 0ad4c66a0..6c558149c 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -3662,10 +3662,16 @@ void sp_nodepath_selected_nodes_rotate(Inkscape::NodePath::Path *nodepath, gdoub rot = angle; } + NR::Point rot_center; + if (Inkscape::NodePath::Path::active_node == NULL) + rot_center = box.midpoint(); + else + rot_center = Inkscape::NodePath::Path::active_node->pos; + NR::Matrix t = - NR::Matrix (NR::translate(-box.midpoint())) * + NR::Matrix (NR::translate(-rot_center)) * NR::Matrix (NR::rotate(rot)) * - NR::Matrix (NR::translate(box.midpoint())); + NR::Matrix (NR::translate(rot_center)); for (GList *l = nodepath->selected; l != NULL; l = l->next) { Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data; @@ -3787,10 +3793,16 @@ void sp_nodepath_selected_nodes_scale(Inkscape::NodePath::Path *nodepath, gdoubl double scale = (box.maxExtent() + grow)/box.maxExtent(); + NR::Point scale_center; + if (Inkscape::NodePath::Path::active_node == NULL) + scale_center = box.midpoint(); + else + scale_center = Inkscape::NodePath::Path::active_node->pos; + NR::Matrix t = - NR::Matrix (NR::translate(-box.midpoint())) * + NR::Matrix (NR::translate(-scale_center)) * NR::Matrix (NR::scale(scale, scale)) * - NR::Matrix (NR::translate(box.midpoint())); + NR::Matrix (NR::translate(scale_center)); for (GList *l = nodepath->selected; l != NULL; l = l->next) { Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data; -- 2.30.2