Merge branch 'css' into compositor-granularity

This commit is contained in:
Will McGugan
2022-05-10 16:06:00 +01:00
9 changed files with 177 additions and 47 deletions

View File

@@ -275,6 +275,24 @@ class Region(NamedTuple):
"""Get the start point of the region."""
return Offset(self.x, self.y)
@property
def bottom_left(self) -> Offset:
"""Bottom left offset of the region."""
x, y, _width, height = self
return Offset(x, y + height)
@property
def top_right(self) -> Offset:
"""Top right offset of the region."""
x, y, width, _height = self
return Offset(x + width, y)
@property
def bottom_right(self) -> Offset:
"""Bottom right of the region."""
x, y, width, height = self
return Offset(x + width, y + height)
@property
def size(self) -> Size:
"""Get the size of the region."""
@@ -292,17 +310,17 @@ class Region(NamedTuple):
@property
def x_range(self) -> range:
"""A range object for X coordinates"""
"""A range object for X coordinates."""
return range(self.x, self.x + self.width)
@property
def y_range(self) -> range:
"""A range object for Y coordinates"""
"""A range object for Y coordinates."""
return range(self.y, self.y + self.height)
@property
def reset_origin(self) -> Region:
"""An region of the same size at the origin."""
"""An region of the same size at (0, 0)."""
_, _, width, height = self
return Region(0, 0, width, height)