mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-28 18:20:14 +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
@@ -104,10 +104,8 @@ KDRect ScrollView::visibleContentRect() {
|
||||
}
|
||||
|
||||
void ScrollView::layoutSubviews() {
|
||||
// Layout contentView
|
||||
// We're only re-positionning the contentView, not modifying its size.
|
||||
KDPoint absoluteOffset = contentOffset().opposite().translatedBy(KDPoint(m_leftMargin, m_topMargin));
|
||||
KDRect contentFrame = KDRect(absoluteOffset, m_contentView->bounds().size());
|
||||
KDRect contentFrame = KDRect(absoluteOffset, contentSize());
|
||||
m_contentView->setFrame(contentFrame);
|
||||
KDSize content(
|
||||
m_contentView->bounds().width() + m_leftMargin + m_rightMargin,
|
||||
@@ -116,10 +114,6 @@ void ScrollView::layoutSubviews() {
|
||||
decorator()->layoutIndicators(content, contentOffset(), m_frame.size());
|
||||
}
|
||||
|
||||
KDSize ScrollView::contentSize() {
|
||||
return m_contentView->minimalSizeForOptimalDisplay();
|
||||
}
|
||||
|
||||
void ScrollView::setContentOffset(KDPoint offset, bool forceRelayout) {
|
||||
if (m_dataSource->setOffset(offset) || forceRelayout) {
|
||||
layoutSubviews();
|
||||
|
||||
Reference in New Issue
Block a user