| 582 | | i2v = self.get_matrix_i2v(i).transform_point |
|---|
| 583 | | x0, y0 = i2v(bounds.x, bounds.y) |
|---|
| 584 | | x1, y1 = i2v(bounds.x1, bounds.y1) |
|---|
| 585 | | vbounds = Rectangle(x0, y0, x1=x1, y1=y1) |
|---|
| 586 | | self._qtree.add(i, vbounds, bounds) |
|---|
| 587 | | |
|---|
| 588 | | # TODO: find an elegant way to update parent bb's. |
|---|
| 589 | | #parent = self.canvas.get_parent(i) |
|---|
| 590 | | #if parent: |
|---|
| 591 | | # try: |
|---|
| 592 | | # parent_bounds = self._qtree.get_bounds(parent) |
|---|
| 593 | | # except KeyError: |
|---|
| 594 | | # pass # No bounds, do nothing |
|---|
| 595 | | # else: |
|---|
| 596 | | # if not vbounds in parent_bounds: |
|---|
| 597 | | # self.set_item_bounding_box(parent, vbounds + parent_bounds) |
|---|
| | 579 | |
|---|
| | 580 | if i not in dirty_items: |
|---|
| | 581 | # Only matrix has changed, so calculate new bb based |
|---|
| | 582 | # on quadtree data (= bb in item coordinates). |
|---|
| | 583 | i2v = self.get_matrix_i2v(i).transform_point |
|---|
| | 584 | x0, y0 = i2v(bounds.x, bounds.y) |
|---|
| | 585 | x1, y1 = i2v(bounds.x1, bounds.y1) |
|---|
| | 586 | vbounds = Rectangle(x0, y0, x1=x1, y1=y1) |
|---|
| | 587 | self._qtree.add(i, vbounds, bounds) |
|---|
| | 588 | |
|---|
| | 589 | # Request bb recalculation for all 'really' dirty items |
|---|