From 7a784353f4785e29cd91a9cd2ef5fa4a0f643841 Mon Sep 17 00:00:00 2001 From: Igor Zinken <730069+igorski@users.noreply.github.com> Date: Sun, 1 Feb 2026 15:01:52 +0100 Subject: [PATCH] cleaner naming --- src/rendering/actors/interaction-pane.ts | 8 ++++---- src/utils/shape-util.ts | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/rendering/actors/interaction-pane.ts b/src/rendering/actors/interaction-pane.ts index 2d92236..f42e533 100644 --- a/src/rendering/actors/interaction-pane.ts +++ b/src/rendering/actors/interaction-pane.ts @@ -227,12 +227,12 @@ export default class InteractionPane extends sprite { const { activeSelection } = this.getActiveDocument(); const selectionShape: Shape = getLastShape( activeSelection ); // the last selection shape we're now closing const currentSelection = activeSelection.slice( 0, -1 ); // is the current selection before commiting selectionShape to it - let selectionToSet = [ ...currentSelection ]; - if ( selectionToSet.length > 0 && isOverlappingShape( selectionToSet, selectionShape )) { + let selectionToSet: Selection; + if ( currentSelection.length > 0 && isOverlappingShape( currentSelection, selectionShape )) { if ( this._selectionOperation === "subtract" ) { - selectionToSet = subtractShapes( selectionToSet, selectionShape ); + selectionToSet = subtractShapes( currentSelection, selectionShape ); } else { - selectionToSet = mergeShapes( selectionToSet, selectionShape ); + selectionToSet = mergeShapes( currentSelection, selectionShape ); } this._selectionOperation = "merge"; } else { diff --git a/src/utils/shape-util.ts b/src/utils/shape-util.ts index cc5fc9f..739642a 100644 --- a/src/utils/shape-util.ts +++ b/src/utils/shape-util.ts @@ -92,7 +92,6 @@ export const mergeShapes = ( shapeList: Shape[], shapeToAdd: Shape ): Shape[] => const polyA = shapeList.map( shape => shape.map( pointToMartinez ) as MartinezShape ); const polyB = [ shapeToAdd.map( pointToMartinez ) as MartinezShape ]; - // Use Martinez polygon clipping to get the union const polygonUnion = union( polyA, polyB ); if ( !polygonUnion || polygonUnion.length === 0 ) { @@ -105,7 +104,6 @@ export const subtractShapes = ( shapeList: Shape[], shapeToSubtract: Shape ): Sh const polyA = shapeList.map( shape => shape.map( pointToMartinez ) as MartinezShape ); const polyB = [ shapeToSubtract.map( pointToMartinez ) as MartinezShape ]; - // Perform polygon difference (cutting) const polygonDifference = diff( polyA, polyB ); if ( !polygonDifference || polygonDifference.length === 0 ) {