diff options
author | Joshua Slack <[email protected]> | 2017-10-18 21:29:57 -0500 |
---|---|---|
committer | Joshua Slack <[email protected]> | 2017-10-18 21:29:57 -0500 |
commit | 3fd632efbe11a65769ccdbbb5c5a61ecaa377f5d (patch) | |
tree | e0fb398ddf8636835f92ade905d295f7bbd25219 /ardor3d-ui | |
parent | c95d4d0f2d611377287a6e461362092a501287ac (diff) |
Fix some additional layout issues.
Fixed pack not setting some container min sizes and thus allowing manual resizing of frame too small.
Diffstat (limited to 'ardor3d-ui')
3 files changed, 12 insertions, 2 deletions
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComponent.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComponent.java index 69362df..a1782bd 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComponent.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComponent.java @@ -63,7 +63,7 @@ public abstract class UIComponent extends Node implements UIKeyHandler { private static float _currentOpacity = 1f; /** The internal contents portion of this component. */ - private final Dimension _contentsSize = new Dimension(10, 10); + private final Dimension _contentsSize = new Dimension(0, 0); /** The absolute minimum size of the internal contents portion of this component. */ private final Dimension _layoutMinimumContentsSize = new Dimension(0, 0); /** The absolute minimum size of the internal contents portion of this component. */ diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrame.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrame.java index f898694..aea3c60 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrame.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrame.java @@ -356,7 +356,7 @@ public class UIFrame extends UIContainer { * Resize the frame to fit the minimum size of its content panel. */ public void pack() { - _contentPanel.updateMinimumSizeFromContents(); + updateMinimumSizeFromContents(); pack(_contentPanel.getMinimumLocalComponentWidth(), _contentPanel.getMinimumLocalComponentHeight()); } diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/RowLayout.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/RowLayout.java index f3131bc..1ec7662 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/RowLayout.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/RowLayout.java @@ -205,6 +205,7 @@ public class RowLayout extends UILayout { // compute the min width and height of the container final Rectangle2 store = new Rectangle2(); + int spaces = -1; for (final Spatial s : content) { if (!(s instanceof UIComponent)) { continue; @@ -222,6 +223,15 @@ public class RowLayout extends UILayout { } minH += rect.getHeight(); } + spaces++; + } + + if (spaces > 0) { + if (_horizontal) { + minW += _spacing * spaces; + } else { + minH += _spacing * spaces; + } } } container.setLayoutMinimumContentSize(minW, minH); |