Code

add a snappoint at the rotation-axis of any shape
authordvlierop2 <dvlierop2@users.sourceforge.net>
Fri, 30 Mar 2007 19:04:54 +0000 (19:04 +0000)
committerdvlierop2 <dvlierop2@users.sourceforge.net>
Fri, 30 Mar 2007 19:04:54 +0000 (19:04 +0000)
src/sp-item.cpp
src/sp-item.h
src/sp-shape.cpp

index 27f6e4ce38d31dcedfd4920ac143774b82b41d6f..28d8ed6bcef6f28a667cc170dd9964dd6910c243 100644 (file)
@@ -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<NR::Rect> bbox = getBounds(sp_item_i2d_affine(this));
     if (bbox) {
         return bbox->midpoint() + NR::Point (this->transform_center_x, this->transform_center_y);
index eb7043096d45ba1d2ba400252505db27b06acd63..9359763b5957d0e3de6418883ba6954ea3dc15c1 100644 (file)
@@ -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;
     
index 453de5650fd017971a280a7c1c7ad069e69446cf..a37da6840540274e02e0cb98772ee84d3fa80ab9 100644 (file)
@@ -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();
+    
 }