mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 09:10:48 +01:00
[escher] update the scroll indicator at each call to layoutSubviews
Change-Id: I3e3d5acbd983f30283ec2090fc7554c38c9cc4b7
This commit is contained in:
committed by
Romain Goyet
parent
7708b903c9
commit
2e116344ea
@@ -56,18 +56,22 @@ void ScrollView::layoutSubviews() {
|
||||
KDPoint absoluteOffset = m_offset.opposite().translatedBy(KDPoint(m_leftMargin, m_topMargin));
|
||||
KDRect contentFrame = KDRect(absoluteOffset, m_contentView->bounds().size());
|
||||
m_contentView->setFrame(contentFrame);
|
||||
|
||||
// We recompute the size of the scroll indicator
|
||||
updateScrollIndicator();
|
||||
}
|
||||
|
||||
void ScrollView::updateScrollIndicator() {
|
||||
float contentHeight = m_contentView->bounds().height()+m_topMargin+m_bottomMargin;
|
||||
float start = m_offset.y();
|
||||
float end = m_offset.y() + m_frame.height();
|
||||
|
||||
m_verticalScrollIndicator.setStart(start/contentHeight);
|
||||
m_verticalScrollIndicator.setEnd(end/contentHeight);
|
||||
}
|
||||
|
||||
void ScrollView::setContentOffset(KDPoint offset) {
|
||||
m_offset = offset;
|
||||
|
||||
float contentHeight = m_contentView->bounds().height()+m_topMargin+m_bottomMargin;
|
||||
float start = offset.y();
|
||||
float end = offset.y() + m_frame.height();
|
||||
|
||||
m_verticalScrollIndicator.setStart(start/contentHeight);
|
||||
m_verticalScrollIndicator.setEnd(end/contentHeight);
|
||||
|
||||
layoutSubviews();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user