summaryrefslogtreecommitdiffstats
path: root/src/nodepath.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2006-05-15 05:54:34 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2006-05-15 05:54:34 +0000
commit93be21b9f6cd8fadc6873113c6148c83422ac0b6 (patch)
treec1b55abd06c194b3340898a5afcf600c70750189 /src/nodepath.cpp
parentreport subpaths in statusbar when > 1 is touched by selection (diff)
downloadinkscape-93be21b9f6cd8fadc6873113c6148c83422ac0b6.tar.gz
inkscape-93be21b9f6cd8fadc6873113c6148c83422ac0b6.zip
sculpt other subpaths too
(bzr r842)
Diffstat (limited to 'src/nodepath.cpp')
-rw-r--r--src/nodepath.cpp53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index b8de67ef0..01a7cfa6b 100644
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
@@ -1091,7 +1091,36 @@ sp_nodepath_selected_nodes_sculpt(Inkscape::NodePath::Path *nodepath, Inkscape::
} while (n_going || p_going);
}
- // Second pass: actually move nodes
+ // Now let's see if we also need to move nodes on other subpaths, and calculate their range too
+ gdouble direct_range = 0;
+ if (sp_nodepath_selection_get_subpath_count(nodepath) > 1) {
+ // For nodes in other subpaths, we calculate the distance from n simply by NR::L2 without
+ // any bezier lengths; the range is the maximum such distance
+
+ // First pass: calculate range
+ for (GList *spl = nodepath->subpaths; spl != NULL; spl = spl->next) {
+ Inkscape::NodePath::SubPath *subpath = (Inkscape::NodePath::SubPath *) spl->data;
+ if (subpath == n->subpath)
+ continue; // this is our source subpath, already processed above
+ for (GList *nl = subpath->nodes; nl != NULL; nl = nl->next) {
+ Inkscape::NodePath::Node *node = (Inkscape::NodePath::Node *) nl->data;
+ if (node->selected) {
+ direct_range = MAX(direct_range, NR::L2(node->origin - n->origin));
+ }
+ }
+ }
+ }
+
+ // is ALL of the current nodepath selected?
+ if (n_nodes + p_nodes == n_sel_nodes + p_sel_nodes) {
+ // then we should really use direct-range instead of n_ and p_ ranges if it is bigger
+ if (direct_range > n_sel_range)
+ n_sel_range = direct_range;
+ if (direct_range > p_sel_range)
+ p_sel_range = direct_range;
+ }
+
+ // Second pass: actually move nodes in this subpath
sp_nodepath_move_node_and_handles (n, delta, delta, delta);
{
double n_range = 0, p_range = 0;
@@ -1137,6 +1166,28 @@ sp_nodepath_selected_nodes_sculpt(Inkscape::NodePath::Path *nodepath, Inkscape::
} while (n_going || p_going);
}
+ // Now let's see if we also need to move nodes on other subpaths
+ if (sp_nodepath_selection_get_subpath_count(nodepath) > 1) {
+ // For nodes in other subpaths, we calculate the distance from n simply by NR::L2 without
+ // any bezier lengths; the range is the maximum such distance
+
+ // Second pass: actually move nodes
+ for (GList *spl = nodepath->subpaths; spl != NULL; spl = spl->next) {
+ Inkscape::NodePath::SubPath *subpath = (Inkscape::NodePath::SubPath *) spl->data;
+ if (subpath == n->subpath)
+ continue; // this is our source subpath, already processed above
+ for (GList *nl = subpath->nodes; nl != NULL; nl = nl->next) {
+ Inkscape::NodePath::Node *node = (Inkscape::NodePath::Node *) nl->data;
+ if (node->selected) {
+ sp_nodepath_move_node_and_handles (node,
+ sculpt_profile (NR::L2(node->origin - n->origin) / direct_range, alpha) * delta,
+ sculpt_profile (NR::L2(node->n.origin - n->origin) / direct_range, alpha) * delta,
+ sculpt_profile (NR::L2(node->p.origin - n->origin) / direct_range, alpha) * delta);
+ }
+ }
+ }
+ }
+
// do not update repr here so that node dragging is acceptably fast
update_object(nodepath);
}