diff --git a/packages/text-annotator/src/SelectionHandler.ts b/packages/text-annotator/src/SelectionHandler.ts index f94e1055..cb4f227f 100644 --- a/packages/text-annotator/src/SelectionHandler.ts +++ b/packages/text-annotator/src/SelectionHandler.ts @@ -147,7 +147,7 @@ export const createSelectionHandler = ( // ...then make the new annotation the current selection selection.userSelect(currentTarget.annotation, lastDownEvent); } - }); + }, 10); document.addEventListener('selectionchange', onSelectionChange); diff --git a/packages/text-annotator/src/highlight/baseRenderer.ts b/packages/text-annotator/src/highlight/baseRenderer.ts index d4fde630..272c854b 100644 --- a/packages/text-annotator/src/highlight/baseRenderer.ts +++ b/packages/text-annotator/src/highlight/baseRenderer.ts @@ -140,7 +140,7 @@ export const createBaseRenderer = ( currentPainter.reset(); redraw(); - }); + }, 10); window.addEventListener('resize', onResize); diff --git a/packages/text-annotator/src/highlight/canvas/canvasRenderer.ts b/packages/text-annotator/src/highlight/canvas/canvasRenderer.ts index 3927200b..12c0f038 100644 --- a/packages/text-annotator/src/highlight/canvas/canvasRenderer.ts +++ b/packages/text-annotator/src/highlight/canvas/canvasRenderer.ts @@ -117,7 +117,7 @@ const createRenderer = (container: HTMLElement): RendererImplementation => { }); }); - const onResize = debounce(() => resetCanvas(canvas)); + const onResize = debounce(() => resetCanvas(canvas), 10); window.addEventListener('resize', onResize);