fix(ui): brush preview not visible after hotkey

This commit is contained in:
psychedelicious 2024-04-20 16:13:52 +10:00 committed by Kent Keirsey
parent 31ace9aff8
commit 15018fdbc0

View File

@ -62,6 +62,9 @@ export const renderBrushPreview = (
layer = new Konva.Layer({ id: BRUSH_PREVIEW_LAYER_ID, visible: tool !== 'move', listening: false });
stage.add(layer);
// The brush preview is hidden and shown as the mouse leaves and enters the stage
stage.on('mousemove', (e) => {
e.target.getStage()?.findOne<Konva.Layer>(`#${BRUSH_PREVIEW_LAYER_ID}`)?.visible(true);
});
stage.on('mouseleave', (e) => {
e.target.getStage()?.findOne<Konva.Layer>(`#${BRUSH_PREVIEW_LAYER_ID}`)?.visible(false);
});