diff options
| author | bulia byak <buliabyak@gmail.com> | 2006-03-22 23:41:24 +0000 |
|---|---|---|
| committer | buliabyak <buliabyak@users.sourceforge.net> | 2006-03-22 23:41:24 +0000 |
| commit | e1898194c0387d236157590f2d10917cb0137aac (patch) | |
| tree | ffcfea1b156dde4cb3f82324e5642cc8164500f3 /src/selection.cpp | |
| parent | rewrote sp_clippath_get_bbox correctly to fix 1455885 (diff) | |
| download | inkscape-e1898194c0387d236157590f2d10917cb0137aac.tar.gz inkscape-e1898194c0387d236157590f2d10917cb0137aac.zip | |
use rotation center in keyboard rotation and transform dialog
(bzr r273)
Diffstat (limited to 'src/selection.cpp')
| -rw-r--r-- | src/selection.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/selection.cpp b/src/selection.cpp index 763713c9d..473a7202e 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -339,6 +339,23 @@ NR::Rect Selection::boundsInDocument() const { return NR::Rect(*boundsInDocument(&r)); } +/** Extract the position of the center from the first selected object */ +NR::Point Selection::center() const { + GSList *items = (GSList *) const_cast<Selection *>(this)->itemList(); + NR::Point center; + if (items) { + SPItem *first = reinterpret_cast<SPItem*>(g_slist_last(items)->data); // from the first item in selection + if (first->isCenterSet()) { // only if set explicitly + center = first->getCenter(); + } else { + center = bounds().midpoint(); + } + } else { + center = bounds().midpoint(); + } + return center; +} + /** * Compute the list of points in the selection that are to be considered for snapping. */ |
