getAbsoluteRect function
Implementation
Rect getAbsoluteRect(Buffer buffer, Rect localRect) {
int x = localRect.x;
int y = localRect.y;
Buffer current = buffer;
while (current is Viewport) {
x += current.bounds.x;
y += current.bounds.y;
current = current.parent;
}
return Rect(x, y, localRect.width, localRect.height);
}