cleaner naming

This commit is contained in:
Igor Zinken
2026-02-01 15:01:52 +01:00
parent 962fa5d047
commit 7a784353f4
2 changed files with 4 additions and 6 deletions

View File

@@ -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 {

View File

@@ -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 ) {