Fix side effect introduced in f7daed6 where cropping a layer would not invalidate the renderers coordinate cache

This commit is contained in:
Igor Zinken
2022-01-31 09:56:19 +01:00
parent 22059511c8
commit 0a4848b723
2 changed files with 6 additions and 7 deletions

View File

@@ -574,7 +574,10 @@ export default {
const { left, top, width, height } = getRectangleForSelection( selection );
const commit = async () => {
await store.commit( "cropActiveDocumentContent", { left, top });
store.commit( "setActiveDocumentSize", { width, height });
store.commit( "setActiveDocumentSize", {
width : Math.min( currentSize.width, width ),
height : Math.min( currentSize.height, height )
});
getCanvasInstance()?.interactionPane.setSelection( null, false );
};
commit();

View File

@@ -179,13 +179,9 @@ export default {
},
async cropActiveDocumentContent( state, { left, top }) {
const document = state.documents[ state.activeIndex ];
for ( let i = 0, l = document?.layers?.length; i < l; ++i ) {
const layer = document.layers[ i ];
// by toggling visiblity we force the Sprite to recache its contents when visible again
const wasVisible = layer.visible;
layer.visible = false;
for ( const layer of document?.layers ) {
await cropLayerContent( layer, left, top );
layer.visible = wasVisible;
getSpriteForLayer( layer )?.syncPosition();
}
},
saveSelection( state, { name, selection }) {