diff options
| author | ospite <> | 2017-05-02 19:27:27 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2017-05-02 19:27:27 +0000 |
| commit | bd5644d34e87bf7f402beee7dac7cc1d0c4510f5 (patch) | |
| tree | af095b59ec120d49d47d88271b4fc196d4af10d7 | |
| parent | Calligraphy mode: creates dots on single click. (diff) | |
| download | inkscape-bd5644d34e87bf7f402beee7dac7cc1d0c4510f5.tar.gz inkscape-bd5644d34e87bf7f402beee7dac7cc1d0c4510f5.zip | |
Add control point at center of stars
Fixed bugs:
- https://launchpad.net/bugs/481506
(bzr r15659)
| -rw-r--r-- | src/ui/object-edit.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/ui/object-edit.cpp b/src/ui/object-edit.cpp index b76e97c15..c1d85a896 100644 --- a/src/ui/object-edit.cpp +++ b/src/ui/object-edit.cpp @@ -1071,6 +1071,12 @@ public: virtual void knot_click(unsigned int state); }; +class StarKnotHolderEntityCenter : public KnotHolderEntity { +public: + virtual Geom::Point knot_get() const; + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); +}; + void StarKnotHolderEntity1::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { @@ -1128,6 +1134,17 @@ StarKnotHolderEntity2::knot_set(Geom::Point const &p, Geom::Point const &/*origi } } +void +StarKnotHolderEntityCenter::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) +{ + SPStar *star = dynamic_cast<SPStar *>(item); + g_assert(star != NULL); + + star->center = snap_knot_position(p, state); + + item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); +} + Geom::Point StarKnotHolderEntity1::knot_get() const { @@ -1151,6 +1168,17 @@ StarKnotHolderEntity2::knot_get() const return sp_star_get_xy(star, SP_STAR_POINT_KNOT2, 0); } +Geom::Point +StarKnotHolderEntityCenter::knot_get() const +{ + g_assert(item != NULL); + + SPStar const *star = dynamic_cast<SPStar const *>(item); + g_assert(star != NULL); + + return star->center; +} + static void sp_star_knot_click(SPItem *item, unsigned int state) { @@ -1202,6 +1230,12 @@ StarKnotHolder::StarKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRel entity.push_back(entity2); } + StarKnotHolderEntityCenter *entity_center = new StarKnotHolderEntityCenter(); + entity_center->create(desktop, item, this, Inkscape::CTRL_TYPE_POINT, + _("Move the star"), + SP_KNOT_SHAPE_CROSS); + entity.push_back(entity_center); + add_pattern_knotholder(); } |
