mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
Escher: Fix absoluteDrawingArea
It needed to compute the absoluteOrigin independently Change-Id: I5aadf4f03da1af965285fc5ae675ddcfbcd34ed0
This commit is contained in:
@@ -58,6 +58,7 @@ protected:
|
||||
KDRect m_frame;
|
||||
private:
|
||||
void redraw(KDRect rect);
|
||||
KDPoint absoluteOrigin() const;
|
||||
KDRect absoluteDrawingArea() const;
|
||||
|
||||
bool m_needsRedraw;
|
||||
|
||||
@@ -133,15 +133,24 @@ KDRect View::bounds() const {
|
||||
return bounds;
|
||||
}
|
||||
|
||||
KDPoint View::absoluteOrigin() const {
|
||||
if (m_superview == nullptr) {
|
||||
assert(this == (View *)window());
|
||||
return m_frame.origin;
|
||||
} else {
|
||||
return KDPointTranslate(m_frame.origin, m_superview->absoluteOrigin());
|
||||
}
|
||||
}
|
||||
|
||||
KDRect View::absoluteDrawingArea() const {
|
||||
if (m_superview == nullptr) {
|
||||
assert(this == (View *)window());
|
||||
return m_frame;
|
||||
} else {
|
||||
KDRect parentDrawingArea = m_superview->absoluteDrawingArea();
|
||||
|
||||
KDRect absoluteFrame = m_frame;
|
||||
absoluteFrame.x += parentDrawingArea.x;
|
||||
absoluteFrame.y += parentDrawingArea.y;
|
||||
absoluteFrame.origin = absoluteOrigin();
|
||||
|
||||
return KDRectIntersection(absoluteFrame, parentDrawingArea);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user