mirror of
https://github.com/igorski/bitmappery.git
synced 2026-07-22 23:08:43 +02:00
cleaner naming
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
Reference in New Issue
Block a user