Sketcher: Fix toggle construction not undoable (#24539)

* Sketcher: Fix toggle construction not undoable

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
PaddleStroke
2025-10-09 19:31:50 +02:00
committed by GitHub
parent 02df83e19d
commit 331e51cdfc

View File

@@ -2116,9 +2116,10 @@ int SketchObject::toggleConstruction(int GeoId)
// triggered by the clearselection of the UI command, this won't update the elements widget, in
// the accumulative of actions it is judged that it is worth to trigger an update here.
auto gft = GeometryFacade::getFacade(vals[GeoId]);
std::unique_ptr<Part::Geometry> geo(vals[GeoId]->clone());
auto gft = GeometryFacade::getFacade(geo.get());
gft->setConstruction(!gft->getConstruction());
this->Geometry.touch();
this->Geometry.set1Value(GeoId, std::move(geo));
}
else {
if (GeoId > GeoEnum::RefExt) {
@@ -2126,10 +2127,10 @@ int SketchObject::toggleConstruction(int GeoId)
}
const std::vector<Part::Geometry*>& extGeos = getExternalGeometry();
auto geo = extGeos[-GeoId - 1];
auto egf = ExternalGeometryFacade::getFacade(geo);
std::unique_ptr<Part::Geometry> geo(extGeos[-GeoId - 1]->clone());
auto egf = ExternalGeometryFacade::getFacade(geo.get());
egf->setFlag(ExternalGeometryExtension::Defining, !egf->testFlag(ExternalGeometryExtension::Defining));
this->ExternalGeo.touch();
this->ExternalGeo.set1Value(-GeoId - 1, std::move(geo));
}
solverNeedsUpdate = true;