diff options
| author | bulia byak <buliabyak@gmail.com> | 2008-05-06 05:55:41 +0000 |
|---|---|---|
| committer | buliabyak <buliabyak@users.sourceforge.net> | 2008-05-06 05:55:41 +0000 |
| commit | d82d8a0e909168ffa4109ad7a67c438f5e086935 (patch) | |
| tree | 56037227ad291a43f6d428758930348be56d2daf /src | |
| parent | reinterpret move when apply-separately checkbox is on (diff) | |
| download | inkscape-d82d8a0e909168ffa4109ad7a67c438f5e086935.tar.gz inkscape-d82d8a0e909168ffa4109ad7a67c438f5e086935.zip | |
limit the change to the relative moves only
(bzr r5616)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/transformation.cpp | 123 |
1 files changed, 65 insertions, 58 deletions
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 5a7117db2..8dcda8dfb 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -601,72 +601,79 @@ Transformation::applyPageMove(Inkscape::Selection *selection) if (prefs_get_int_attribute_limited ("dialogs.transformation", "applyseparately", 0, 0, 1) == 0) { // move selection as a whole - if (_check_move_relative.get_active()) { - sp_selection_move_relative(selection, x, y); - } else { - NR::Maybe<NR::Rect> bbox = selection->bounds(); - if (bbox) { - sp_selection_move_relative(selection, - x - bbox->min()[NR::X], y - bbox->min()[NR::Y]); + if (_check_move_relative.get_active()) { + sp_selection_move_relative(selection, x, y); + } else { + NR::Maybe<NR::Rect> bbox = selection->bounds(); + if (bbox) { + sp_selection_move_relative(selection, + x - bbox->min()[NR::X], y - bbox->min()[NR::Y]); + } } - } } else { - // shift each object relatively to the previous one - - using Inkscape::Util::GSListConstIterator; - std::list<SPItem *> selected; - selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL); - if (selected.empty()) return; - - if (fabs(x) > 1e-6) { - std::vector< BBoxSort > sorted; - for (std::list<SPItem *>::iterator it(selected.begin()); - it != selected.end(); - ++it) - { - NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it); - if (bbox) { - sorted.push_back(BBoxSort(*it, *bbox, NR::X, x > 0? 1. : 0., x > 0? 0. : 1.)); + + if (_check_move_relative.get_active()) { + // shift each object relatively to the previous one + using Inkscape::Util::GSListConstIterator; + std::list<SPItem *> selected; + selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL); + if (selected.empty()) return; + + if (fabs(x) > 1e-6) { + std::vector< BBoxSort > sorted; + for (std::list<SPItem *>::iterator it(selected.begin()); + it != selected.end(); + ++it) + { + NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it); + if (bbox) { + sorted.push_back(BBoxSort(*it, *bbox, NR::X, x > 0? 1. : 0., x > 0? 0. : 1.)); + } + } + //sort bbox by anchors + std::sort(sorted.begin(), sorted.end()); + + double move = x; + for ( std::vector<BBoxSort> ::iterator it (sorted.begin()); + it < sorted.end(); + it ++ ) + { + sp_item_move_rel(it->item, NR::translate(move, 0)); + // move each next object by x relative to previous + move += x; } } - //sort bbox by anchors - std::sort(sorted.begin(), sorted.end()); - - double move = x; - for ( std::vector<BBoxSort> ::iterator it (sorted.begin()); - it < sorted.end(); - it ++ ) - { - sp_item_move_rel(it->item, NR::translate(move, 0)); - // move each next object by x relative to previous - move += x; - } - } - if (fabs(y) > 1e-6) { - std::vector< BBoxSort > sorted; - for (std::list<SPItem *>::iterator it(selected.begin()); - it != selected.end(); - ++it) - { - NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it); - if (bbox) { - sorted.push_back(BBoxSort(*it, *bbox, NR::Y, y > 0? 1. : 0., y > 0? 0. : 1.)); + if (fabs(y) > 1e-6) { + std::vector< BBoxSort > sorted; + for (std::list<SPItem *>::iterator it(selected.begin()); + it != selected.end(); + ++it) + { + NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it); + if (bbox) { + sorted.push_back(BBoxSort(*it, *bbox, NR::Y, y > 0? 1. : 0., y > 0? 0. : 1.)); + } + } + //sort bbox by anchors + std::sort(sorted.begin(), sorted.end()); + + double move = y; + for ( std::vector<BBoxSort> ::iterator it (sorted.begin()); + it < sorted.end(); + it ++ ) + { + sp_item_move_rel(it->item, NR::translate(0, move)); + // move each next object by x relative to previous + move += y; } } - //sort bbox by anchors - std::sort(sorted.begin(), sorted.end()); - - double move = y; - for ( std::vector<BBoxSort> ::iterator it (sorted.begin()); - it < sorted.end(); - it ++ ) - { - sp_item_move_rel(it->item, NR::translate(0, move)); - // move each next object by x relative to previous - move += y; + } else { + NR::Maybe<NR::Rect> bbox = selection->bounds(); + if (bbox) { + sp_selection_move_relative(selection, + x - bbox->min()[NR::X], y - bbox->min()[NR::Y]); } } - } sp_document_done ( sp_desktop_document (selection->desktop()) , SP_VERB_DIALOG_TRANSFORM, |
