feat(ui): add debug button

This commit is contained in:
psychedelicious 2024-07-30 16:35:27 +10:00
parent fd616f247c
commit ae3e473024
2 changed files with 14 additions and 0 deletions

View File

@ -27,6 +27,12 @@ export const ControlLayersToolbar = memo(() => {
l.calculateBbox();
}
}, [canvasManager]);
const debug = useCallback(() => {
if (!canvasManager) {
return;
}
canvasManager.logDebugInfo();
}, [canvasManager]);
return (
<Flex w="full" gap={2}>
<Flex flex={1} justifyContent="center">
@ -40,6 +46,7 @@ export const ControlLayersToolbar = memo(() => {
{tool === 'eraser' && <EraserWidth />}
</Flex>
<Button onClick={bbox}>bbox</Button>
<Button onClick={debug}>debug</Button>
<Flex flex={1} justifyContent="center">
<Flex gap={2} marginInlineStart="auto" alignItems="center">
<FillColorPicker />

View File

@ -547,4 +547,11 @@ export class CanvasManager {
return getInitialImage({ ...arg, manager: this });
}
}
logDebugInfo() {
console.log(this);
for (const layer of this.layers.values()) {
console.log(layer);
}
}
}