From 4512dba21078b07b6bf91f618bc450447d786828 Mon Sep 17 00:00:00 2001 From: Yann Massard Date: Tue, 9 Apr 2024 15:35:56 +0200 Subject: [PATCH] fix firefox toolbar button layout --- .../tool-container/AbstractUiToolContainer.ts | 8 ++++ .../TeamAppsJettyEmbeddedServerTest.java | 38 ++++++++----------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/teamapps-client/ts/modules/tool-container/AbstractUiToolContainer.ts b/teamapps-client/ts/modules/tool-container/AbstractUiToolContainer.ts index 81c635c45..679a4b7ef 100644 --- a/teamapps-client/ts/modules/tool-container/AbstractUiToolContainer.ts +++ b/teamapps-client/ts/modules/tool-container/AbstractUiToolContainer.ts @@ -84,6 +84,11 @@ export abstract class AbstractUiToolContainer maxHeight || $button.offsetWidth > width || childOverflow) ? 1 : -1; width = width + (jumpSize * jumpDirection); $button.style.width = width + "px"; + + if (isFirefox) { // for some reason, firefox does not reflow here, even when calling $button.offsetHeight. So we need to do it the ugly way. + $buttonWrapper.remove(); + this.$sizeTestingContainer.appendChild($buttonWrapper); + } } if ($button.offsetHeight > maxHeight || $button.offsetWidth > width) { width += 2; @@ -103,4 +108,7 @@ export abstract class AbstractUiToolContainer { - System.out.println("closed."); - }); - - window.setContent(new DummyComponent()); - - Button button = Button.create("show"); - button.onClicked.addListener((eventData, disposable) -> { - window.show(); - }); - rootPanel.setContent(button); + Panel panel = new Panel(); + Toolbar toolbar = new Toolbar(); + ToolbarButtonGroup buttonGroup = new ToolbarButtonGroup(); + buttonGroup.addButton(ToolbarButton.create(MaterialIcon.MENU, "One", "One")); + buttonGroup.addButton(ToolbarButton.create(MaterialIcon.MENU, "Two Words", "Two Words")); + buttonGroup.addButton(ToolbarButton.create(MaterialIcon.MENU, "Three short words", "three short words")); + buttonGroup.addButton(ToolbarButton.create(MaterialIcon.MENU, "Four words for you", "Four words for you")); + toolbar.addButtonGroup(buttonGroup); + panel.setToolbar(toolbar); + + rootPanel.setContent(panel); }) .setPort(8082)