mirror of
https://github.com/igorski/bitmappery.git
synced 2026-06-17 03:34:56 +02:00
Fix side effect introduced in f7daed6 where cropping a layer would not invalidate the renderers coordinate cache
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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 }) {
|
||||
|
||||
Reference in New Issue
Block a user