mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-25 16:50:50 +01:00
[escher/scroll_view] Fix virtuality issues of layoutSubviews
Method contentSize() made virtual and overridden by ScrollableView so that ScrollableView and TableView do not need to setSize themselves and that setSize/setFrame is not called twice over m_contentView.
This commit is contained in:
committed by
EmilieNumworks
parent
c439d6f376
commit
cda88b3c3b
@@ -50,10 +50,9 @@ void ScrollableView::reloadScroll(bool forceReLayout) {
|
||||
setContentOffset(m_manualScrollingOffset, forceReLayout);
|
||||
}
|
||||
|
||||
void ScrollableView::layoutSubviews() {
|
||||
KDSize viewSize = contentSize();
|
||||
KDCoordinate viewWidth = max(viewSize.width(), bounds().width() - leftMargin() - rightMargin());
|
||||
KDCoordinate viewHeight = max(viewSize.height(), bounds().height() - topMargin() - bottomMargin());
|
||||
m_contentView->setSize(KDSize(viewWidth, viewHeight));
|
||||
ScrollView::layoutSubviews();
|
||||
KDSize ScrollableView::contentSize() const {
|
||||
KDSize viewSize = ScrollView::contentSize();
|
||||
KDCoordinate viewWidth = max(viewSize.width(), maxContentWidthDisplayableWithoutScrolling());
|
||||
KDCoordinate viewHeight = max(viewSize.height(), maxContentHeightDisplayableWithoutScrolling());
|
||||
return KDSize(viewWidth, viewHeight);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user