diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a35e833..a592f32a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +### 9.3.10 (2024-05-23) + +- Fix chrome clear canvas issue +- Typescript fixes + ### 9.3.9 (2024-05-20) - Fix underline and line-through for `Konva.Text` when `Konva._fixTextRendering = true` diff --git a/src/Stage.ts b/src/Stage.ts index 48bbeb14..d06cb19a 100644 --- a/src/Stage.ts +++ b/src/Stage.ts @@ -965,3 +965,15 @@ _registerNode(Stage); * stage.container(container); */ Factory.addGetterSetter(Stage, 'container'); + +// chrome is clearing canvas in inactive browser window, causing layer content to be erased +// so let's redraw layers as soon as window becomes active +// TODO: any other way to solve this issue? +// TODO: should we remove it if chrome fixes the issue? +if (Konva.isBrowser) { + window.addEventListener('focus', () => { + stages.forEach((stage) => { + stage.batchDraw(); + }); + }); +} diff --git a/src/shapes/Transformer.ts b/src/shapes/Transformer.ts index 6cec4a83..b96d9433 100644 --- a/src/shapes/Transformer.ts +++ b/src/shapes/Transformer.ts @@ -47,7 +47,7 @@ export interface TransformerConfig extends ContainerConfig { newPos: Vector2d, evt: any ) => Vector2d; - anchorStyleFunc?: (anchor: Shape) => void; + anchorStyleFunc?: (anchor: Rect) => void; } var EVENTS_NAME = 'tr-konva';