From 9a765750828e98899c606cbf942710c494869169 Mon Sep 17 00:00:00 2001 From: Prokhorov Kirill Date: Thu, 26 Sep 2024 20:12:53 +0300 Subject: [PATCH] Fix bug --- DesktopEditor/graphics/BooleanOperations.cpp | 4 +++- DesktopEditor/graphics/BooleanOperations.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DesktopEditor/graphics/BooleanOperations.cpp b/DesktopEditor/graphics/BooleanOperations.cpp index 70ecaf4c74..acefce3f1c 100644 --- a/DesktopEditor/graphics/BooleanOperations.cpp +++ b/DesktopEditor/graphics/BooleanOperations.cpp @@ -1117,7 +1117,7 @@ void CBooleanOperations::PreparePath(const CGraphicsPath& path, int id, curves.push_back(Curve(segments[i], i == (length - 1) ? segments[0] : segments[i + 1])); } -void CBooleanOperations::InsertSegment(const Segment& segment, const Segment& handles, bool updateHandles) +void CBooleanOperations::InsertSegment(Segment& segment, const Segment& handles, bool updateHandles) { if (segment.Id == 1) { @@ -1125,6 +1125,7 @@ void CBooleanOperations::InsertSegment(const Segment& segment, const Segment& ha index = segment.Index == length ? 0 : segment.Index; if (getDistance(segment.P, Segments1[index].P) <= GEOMETRIC_EPSILON) { + segment.Index = index; Segments1[index] = segment; return; } @@ -1148,6 +1149,7 @@ void CBooleanOperations::InsertSegment(const Segment& segment, const Segment& ha index = segment.Index == length ? 0 : segment.Index; if (getDistance(segment.P, Segments2[index].P) <= GEOMETRIC_EPSILON) { + segment.Index = index; Segments2[index] = segment; return; } diff --git a/DesktopEditor/graphics/BooleanOperations.h b/DesktopEditor/graphics/BooleanOperations.h index c059f0c9ac..e0983e3d3f 100644 --- a/DesktopEditor/graphics/BooleanOperations.h +++ b/DesktopEditor/graphics/BooleanOperations.h @@ -120,7 +120,7 @@ namespace Aggplus // Path void PreparePath(const CGraphicsPath& path, int id, std::vector& segments, std::vector& curves, bool reverse = false); - void InsertSegment(const Segment& segment, const Segment& handles, bool updateHandles); + void InsertSegment(Segment& segment, const Segment& handles, bool updateHandles); Curve GetCurve(const Segment& segment) const noexcept; Curve GetPreviousCurve(const Curve& curve) const noexcept; Curve GetNextCurve(const Curve& curve) const noexcept;