diff options
author | Ralf Muri | 2020-01-21 07:21:44 +0000 |
---|---|---|
committer | Ralf Muri | 2020-01-30 06:32:32 +0000 |
commit | e043d51fee4efa47c49faa05b4ba5cf88fa6b6f8 (patch) | |
tree | 55f50c2c20ec9a6c16950c5cc6f7bb5759625121 | |
parent | eaa023a92f2d09a288f706ee9fffc7d1708f0544 (diff) | |
download | org.eclipse.scout.rt-e043d51fee4efa47c49faa05b4ba5cf88fa6b6f8.tar.gz org.eclipse.scout.rt-e043d51fee4efa47c49faa05b4ba5cf88fa6b6f8.tar.xz org.eclipse.scout.rt-e043d51fee4efa47c49faa05b4ba5cf88fa6b6f8.zip |
respect icon width when computing the correct text width
257290
Change-Id: Iedab36e85cf7d6527448a633286247f93bd1113c
Reviewed-on: https://git.eclipse.org/r/156239
Tested-by: CI Bot
Reviewed-by: Andre Wegmueller <awe@bsiag.com>
-rw-r--r-- | org.eclipse.scout.rt.ui.html/src/main/js/scout/desktop/outline/PageLayout.js | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/org.eclipse.scout.rt.ui.html/src/main/js/scout/desktop/outline/PageLayout.js b/org.eclipse.scout.rt.ui.html/src/main/js/scout/desktop/outline/PageLayout.js index 9350867d2a..5a12f72260 100644 --- a/org.eclipse.scout.rt.ui.html/src/main/js/scout/desktop/outline/PageLayout.js +++ b/org.eclipse.scout.rt.ui.html/src/main/js/scout/desktop/outline/PageLayout.js @@ -23,18 +23,24 @@ scout.PageLayout.prototype.layout = function($container) { titleHeight = 0, iconHeight = 0, nodeMenuBar = this.outline.nodeMenuBar, - nodeMenuBarWidth = 0, detailMenuBar = this.outline.detailMenuBar, - detailMenuBarHeight = 0; + detailMenuBarHeight = 0, + textWidth = 0; containerSize = htmlContainer.availableSize() .subtract(htmlContainer.insets()); + textWidth = containerSize.width; + + if ($icon.length > 0) { + textWidth -= scout.graphics.prefSize($icon).width; + } if (nodeMenuBar.visible) { - nodeMenuBarWidth = nodeMenuBar.htmlComp.prefSize().width; - $text.cssWidth(containerSize.width - nodeMenuBarWidth); + textWidth -= nodeMenuBar.htmlComp.prefSize().width; } + $text.cssWidth(textWidth); + if (detailMenuBar.visible) { detailMenuBarHeight = detailMenuBar.htmlComp.prefSize().height; detailMenuBarSize = new scout.Dimension(containerSize.width, detailMenuBarHeight) @@ -62,19 +68,24 @@ scout.PageLayout.prototype.preferredLayoutSize = function($container) { detailMenuBar = this.outline.detailMenuBar, detailMenuBarPrefSize = new scout.Dimension(), nodeMenuBar = this.outline.nodeMenuBar, - nodeMenuBarWidth = 0; + textWidth = 0; containerSize = htmlContainer.size() .subtract(htmlContainer.insets()); + textWidth = containerSize.width; + + if ($icon.length > 0) { + textWidth -= scout.graphics.prefSize($icon).width; + } if (nodeMenuBar.visible) { - nodeMenuBarWidth = nodeMenuBar.htmlComp.prefSize().width; + textWidth -= nodeMenuBar.htmlComp.prefSize().width; } // needs a width to be able to calculate the pref height -> container width needs to be correct already textHeight = scout.graphics.prefSize($text, { includeMargin: true, - widthHint: containerSize.width - nodeMenuBarWidth + widthHint: textWidth }).height; if ($icon.length > 0) { |