Skip to content

Commit b7c6698

Browse files
committed
Fix bug where cutting a selection would not correctly render the cut pixels
1 parent 641828c commit b7c6698

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/store/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export default {
270270
commit( "showNotification", { message: translate( isCut ? "selectionCut" : "selectionCopied" ) });
271271
},
272272
async requestSelectionCut({ dispatch }: ActionContext<BitMapperyState, any> ): Promise<void> {
273-
dispatch( "requestSelectionCopy", { merged: false, isCut: true });
273+
await dispatch( "requestSelectionCopy", { merged: false, isCut: true });
274274
dispatch( "deleteInSelection" );
275275
},
276276
clearSelection(): void {
@@ -310,21 +310,22 @@ export default {
310310
if ( !activeLayer || !getters.activeDocument?.activeSelection.length ) {
311311
return;
312312
}
313-
const hasMask = !!activeLayer.mask;
313+
const hasMask = !!activeLayer.mask && getters.activeLayerMask === activeLayer.mask;
314314
const orgContent = cloneCanvas( hasMask ? activeLayer.mask : activeLayer.source );
315315
const updatedBitmap = deleteSelectionContent( getters.activeDocument, activeLayer );
316+
316317
const replaceSource = ( newSource: HTMLCanvasElement ) => {
317318
replaceLayerSource( activeLayer, newSource, hasMask );
318319
getRendererForLayer( activeLayer )?.resetFilterAndRecache();
319320
};
320321
replaceSource( updatedBitmap );
321322
enqueueState( `deleteFromSelection_${activeLayer.id}`, {
322-
undo() {
323+
undo(): void {
323324
replaceSource( orgContent );
324325
},
325-
redo() {
326+
redo(): void {
326327
replaceSource( updatedBitmap );
327-
}
328+
},
328329
});
329330
},
330331
/**

0 commit comments

Comments
 (0)