def to_rect(r): if isinstance(r, Rect): return r (l, b), (right, t) = (r.b_box or r.db_id.b_box) return Rect.from_edges(l, right, b, t, layer_of(r))
def _bbox(self) -> Rect: (left, bottom), (right, top) = self.db.b_box return Rect.from_edges(left, right, bottom, top)