diff --git a/libs/flake/KoShape.cpp b/libs/flake/KoShape.cpp index bd4fb987f930796c5a8be2e001da02c424fac8bc..9e0c27d0fa2d9290865e49e6d7f85ba36dfc2873 100644 --- a/libs/flake/KoShape.cpp +++ b/libs/flake/KoShape.cpp @@ -296,14 +296,9 @@ void KoShape::copySettings(const KoShape *shape) { m_keepAspect = shape->keepAspectRatio(); } -void KoShape::moveLeft(double distance) { - m_pos.setX(m_pos.x() + distance); - recalcMatrix(); -} - -void KoShape::moveTop(double distance) { - m_pos.setY(m_pos.y() + distance); - recalcMatrix(); +void KoShape::moveBy(double distanceX, double distanceY) { + QPointF p = absolutePosition(); + setAbsolutePosition(QPointF(p.x() + distanceX, p.y() + distanceY)); } // static diff --git a/libs/flake/KoShape.h b/libs/flake/KoShape.h index d28ba2cacd95f79c385f28731b41fc939c671fb6..a3a77b86d74aa629ae41ec98cd5c1477db9e218f 100644 --- a/libs/flake/KoShape.h +++ b/libs/flake/KoShape.h @@ -135,9 +135,17 @@ public: */ void shear( double sx, double sy ); + /** + * Return the current horizontal shearing angle for this shape. + * @return the current horizontal shearing angle for this shape. + */ double shearX() const { return m_shearX; } - double shearY() const { return m_shearY; } + /** + * Return the current vertical shearing angle for this shape. + * @return the current vertical shearing angle for this shape. + */ + double shearY() const { return m_shearY; } /** * @brief Resize the shape @@ -199,6 +207,12 @@ public: */ void addConnectionPoint( const QPointF &point ) { m_connectors.append( point ); } + /** + * Return a list of the connectors that have been added to this shape. + * Note that altering the list or the points in there will not have any + * effect on the shape. + * @return a list of the connectors that have been added to this shape. + */ QList connectors() const { return m_connectors.toList(); } /** @@ -392,8 +406,15 @@ public: */ void setAbsolutePosition(QPointF newPosition); - void moveLeft(double distance); - void moveTop(double distance); + /** + * Move this shape from its current (absolute) position over a specified distance. + * This takes the position of the shape, and moves it in the normal plain. This takes + * into account the rotation of the object so distanceX really will be the resulting + * horizontal distance. + * @param distanceX the horizontal distance to move + * @param distanceX the vertical distance to move + */ + void moveBy(double distanceX, double distanceY); protected: QMatrix m_invMatrix; @@ -409,7 +430,13 @@ protected: */ static void applyConversion(QPainter &painter, const KoViewConverter &converter); - void copySettings(const KoShape *shape); + /** + * Copy all the settings from the parameter shape and apply them to this shape. + * Settings like the position and rotation to visible and locked. The parent + * is a notable exclusion. + * @param shape the shape to use as original + */ + virtual void copySettings(const KoShape *shape); private: double m_scaleX;