From 305f45fa330d930133ea8dd20f83e486daf84676 Mon Sep 17 00:00:00 2001 From: dvlierop2 Date: Fri, 30 Mar 2007 19:04:54 +0000 Subject: [PATCH] add a snappoint at the rotation-axis of any shape --- src/sp-item.cpp | 2 +- src/sp-item.h | 2 +- src/sp-shape.cpp | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 27f6e4ce3..28d8ed6bc 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -296,7 +296,7 @@ bool SPItem::isCenterSet() { return (transform_center_x != 0 || transform_center_y != 0); } -NR::Point SPItem::getCenter() { +NR::Point SPItem::getCenter() const { NR::Maybe bbox = getBounds(sp_item_i2d_affine(this)); if (bbox) { return bbox->midpoint() + NR::Point (this->transform_center_x, this->transform_center_y); diff --git a/src/sp-item.h b/src/sp-item.h index eb7043096..9359763b5 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -138,7 +138,7 @@ struct SPItem : public SPObject { void setCenter(NR::Point object_centre); void unsetCenter(); bool isCenterSet(); - NR::Point getCenter(); + NR::Point getCenter() const; bool isVisibleAndUnlocked() const; diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 453de5650..a37da6840 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -1022,6 +1022,10 @@ static void sp_shape_snappoints(SPItem const *item, SnapPointsIter p) *p = bp->c(3) * i2d; bp++; } + + // Additionaly, add the center for snapping + *p = shape->getCenter(); + } -- 2.30.2