From 722a606958164fd739c056e6659d72d077ad5756 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Mon, 25 Mar 2024 21:50:40 +0100 Subject: [PATCH] not set curve twice --- src/object/sp-ellipse.cpp | 4 +++- src/object/sp-ellipse.h | 1 + src/object/sp-rect.cpp | 5 +++-- src/object/sp-rect.h | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/object/sp-ellipse.cpp b/src/object/sp-ellipse.cpp index 1db7c0ecd4..8e620b3e59 100644 --- a/src/object/sp-ellipse.cpp +++ b/src/object/sp-ellipse.cpp @@ -227,6 +227,7 @@ void SPGenericEllipse::update(SPCtx *ctx, guint flags) this->ry.update(em, ex, dr); this->set_shape(); + curve_set = true; } SPShape::update(ctx, flags); @@ -607,9 +608,10 @@ void SPGenericEllipse::snappoints(std::vector &p, void SPGenericEllipse::modified(guint flags) { - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { + if (!curve_set && flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { this->set_shape(); } + curve_set = false; SPShape::modified(flags); } diff --git a/src/object/sp-ellipse.h b/src/object/sp-ellipse.h index 192ee03fc8..c8db5ea366 100644 --- a/src/object/sp-ellipse.h +++ b/src/object/sp-ellipse.h @@ -95,6 +95,7 @@ protected: /** * @brief Determines whether the shape is a part of an ellipse. */ + mutable bool curve_set = false; bool _isSlice() const; }; diff --git a/src/object/sp-rect.cpp b/src/object/sp-rect.cpp index def363af99..06dc271f8b 100644 --- a/src/object/sp-rect.cpp +++ b/src/object/sp-rect.cpp @@ -163,7 +163,7 @@ void SPRect::update(SPCtx* ctx, unsigned int flags) { this->rx.update(em, ex, w); this->ry.update(em, ex, h); this->set_shape(); - + curve_set = true; flags &= ~SP_OBJECT_USER_MODIFIED_FLAG_B; // since we change the description, it's not a "just translation" anymore } @@ -340,9 +340,10 @@ bool SPRect::set_rect_path_attribute(Inkscape::XML::Node *repr) void SPRect::modified(guint flags) { - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { + if (!curve_set && flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { this->set_shape(); } + curve_set = false; SPShape::modified(flags); } diff --git a/src/object/sp-rect.h b/src/object/sp-rect.h index f157e81e10..cb86e82352 100644 --- a/src/object/sp-rect.h +++ b/src/object/sp-rect.h @@ -81,6 +81,7 @@ public: SVGLength ry; private: + mutable bool curve_set = false; static double vectorStretch(Geom::Point p0, Geom::Point p1, Geom::Affine xform); }; -- GitLab