boundingBox property
This method returns the bounding box of the element (relative to the main
frame), or null
if the element is not visible.
Implementation
Future<Rectangle?> get boundingBox async {
var result = await boxModel;
if (result == null) return null;
var quad = result.border;
var x = [0, 2, 4, 6].map((i) => quad.value[i]).reduce(min);
var y = [1, 3, 5, 7].map((i) => quad.value[i]).reduce(min);
var width = [0, 2, 4, 6].map((i) => quad.value[i]).reduce(max) - x;
var height = [1, 3, 5, 7].map((i) => quad.value[i]).reduce(max) - y;
return Rectangle(x, y, width, height);
}