mirror of https://github.com/buggins/dlangui.git
ListWidget - uneeded second child measure, fix scrollbar bug - should partially fix dlangide bug 236
This commit is contained in:
parent
1b8f87c214
commit
6ab38d89e5
|
@ -1031,7 +1031,6 @@ class ListWidget : WidgetGroup, OnScrollHandler, OnAdapterChangeHandler {
|
||||||
sz.y += w.measuredHeight;
|
sz.y += w.measuredHeight;
|
||||||
} else {
|
} else {
|
||||||
// Horizontal
|
// Horizontal
|
||||||
w.measure(pwidth, pheight);
|
|
||||||
if (sz.y < w.measuredHeight)
|
if (sz.y < w.measuredHeight)
|
||||||
sz.y = w.measuredHeight;
|
sz.y = w.measuredHeight;
|
||||||
sz.x += w.measuredWidth;
|
sz.x += w.measuredWidth;
|
||||||
|
@ -1172,15 +1171,9 @@ class ListWidget : WidgetGroup, OnScrollHandler, OnAdapterChangeHandler {
|
||||||
if (_lastMeasureWidth != rc.width || _lastMeasureHeight != rc.height)
|
if (_lastMeasureWidth != rc.width || _lastMeasureHeight != rc.height)
|
||||||
measure(parentrc.width, parentrc.height);
|
measure(parentrc.width, parentrc.height);
|
||||||
|
|
||||||
// layout scrollbar
|
// hide scrollbar or update rc for scrollbar
|
||||||
|
Rect sbrect = rc;
|
||||||
if (_needScrollbar) {
|
if (_needScrollbar) {
|
||||||
_scrollbar.visibility = Visibility.Visible;
|
|
||||||
Rect sbrect = rc;
|
|
||||||
if (_orientation == Orientation.Vertical)
|
|
||||||
sbrect.left = sbrect.right - _sbsz.x;
|
|
||||||
else
|
|
||||||
sbrect.top = sbrect.bottom - _sbsz.y;
|
|
||||||
_scrollbar.layout(sbrect);
|
|
||||||
rc.right -= _sbsz.x;
|
rc.right -= _sbsz.x;
|
||||||
rc.bottom -= _sbsz.y;
|
rc.bottom -= _sbsz.y;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1192,6 +1185,16 @@ class ListWidget : WidgetGroup, OnScrollHandler, OnAdapterChangeHandler {
|
||||||
// calc item rectangles
|
// calc item rectangles
|
||||||
updateItemPositions();
|
updateItemPositions();
|
||||||
|
|
||||||
|
// layout scrollbar - must be under updateItemPositions()
|
||||||
|
if (_needScrollbar) {
|
||||||
|
_scrollbar.visibility = Visibility.Visible;
|
||||||
|
if (_orientation == Orientation.Vertical)
|
||||||
|
sbrect.left = sbrect.right - _sbsz.x;
|
||||||
|
else
|
||||||
|
sbrect.top = sbrect.bottom - _sbsz.y;
|
||||||
|
_scrollbar.layout(sbrect);
|
||||||
|
}
|
||||||
|
|
||||||
if (_makeSelectionVisibleOnNextLayout) {
|
if (_makeSelectionVisibleOnNextLayout) {
|
||||||
makeSelectionVisible();
|
makeSelectionVisible();
|
||||||
_makeSelectionVisibleOnNextLayout = false;
|
_makeSelectionVisibleOnNextLayout = false;
|
||||||
|
|
Loading…
Reference in New Issue