Simpler function to translate a point based on origin coordinates (`self._ox` and `self._oy`). TODO: merge with getTransformed.
(self, p)
| 710 | # Transformations. |
| 711 | |
| 712 | def translatePoint(self, p): |
| 713 | """Simpler function to translate a point based on origin coordinates |
| 714 | (`self._ox` and `self._oy`). |
| 715 | |
| 716 | TODO: merge with getTransformed. |
| 717 | """ |
| 718 | x, y = point2D(upt(p)) |
| 719 | x = self._ox + x |
| 720 | |
| 721 | '''Because the origin is at the bottom, like in DrawBot and as opposed |
| 722 | to Flat, we need to subtract all vertical coordinates from the page |
| 723 | height before an object gets placed. In case of (bounding) boxes, we |
| 724 | also need to subtract the box height.''' |
| 725 | y = self.height - (self._oy + y) |
| 726 | return upt(x, y) |
| 727 | |
| 728 | def transform(self, matrix, center=(0, 0)): |
| 729 | """Transform canvas over matrix t, e.g. (1, 0, 0, 1, dx, dy) to shift |