diff --git a/inception/inception-brat-editor/src/main/ts/src/BratEditor.ts b/inception/inception-brat-editor/src/main/ts/src/BratEditor.ts index 4cbbff2a2e8..3cffb830ce1 100644 --- a/inception/inception-brat-editor/src/main/ts/src/BratEditor.ts +++ b/inception/inception-brat-editor/src/main/ts/src/BratEditor.ts @@ -41,6 +41,15 @@ export class BratEditor implements AnnotationEditor { element.dispatcher = this.dispatcher element.visualizer = this.visualizer + // Ensure that the visualizer is resized when the container element size changes, e.g. when + // the sidebars are opened or closed. + if (element.parentElement) { + new ResizeObserver(() => { + console.log(`resize: ${element.id} ${element.clientWidth} ${element.clientHeight}`) + this.dispatcher.post('resize') + }).observe(element.parentElement) + } + this.resizer = new ResizeManager(this.dispatcher, this.visualizer, ajax) } diff --git a/inception/inception-brat-editor/src/main/ts/src/visualizer_ui/VisualizerUI.ts b/inception/inception-brat-editor/src/main/ts/src/visualizer_ui/VisualizerUI.ts index 837aa5b722e..01e083eb9c5 100644 --- a/inception/inception-brat-editor/src/main/ts/src/visualizer_ui/VisualizerUI.ts +++ b/inception/inception-brat-editor/src/main/ts/src/visualizer_ui/VisualizerUI.ts @@ -447,7 +447,7 @@ export class VisualizerUI { resizerTimeout: number onResize (evt: Event) { - if (evt.target === window) { + if (!evt || evt.target === window) { clearTimeout(this.resizerTimeout) this.resizerTimeout = setTimeout(() => this.dispatcher.post('rerender'), 300) } diff --git a/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/sidebar/SidebarTabbedPanel.java b/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/sidebar/SidebarTabbedPanel.java index 9f5ed3d90bd..d5127590f9c 100644 --- a/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/sidebar/SidebarTabbedPanel.java +++ b/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/sidebar/SidebarTabbedPanel.java @@ -82,7 +82,7 @@ private void showHideAction(AjaxRequestTarget aTarget) { expanded = !expanded; saveSidebarState(); - WicketUtil.refreshPage(aTarget, getPage()); + aTarget.add(findParent(SidebarPanel.class)); } public boolean isExpanded()