def update_bbox(self): bp = libgeom.apply_trafo_to_point([0.0, 0.0], self.trafo) self.cache_bbox = 2 * bp index = 0 for item in self.cache_cpath: if not item: data = self.cache_layout_data[index] bp = [data[0], data[4]] bbox = 2 * libgeom.apply_trafo_to_point(bp, self.trafo) else: bbox = libgeom.get_cpath_bbox(item) if not self.cache_bbox: self.cache_bbox = bbox else: self.cache_bbox = libgeom.sum_bbox(self.cache_bbox, bbox) index += 1
def _get_fixed_bbox(self, obj): bbox = obj.cache_bbox if obj.is_curve and obj.cache_arrows: for pair in obj.cache_arrows: for item in pair: if item: arrow_bbox = libgeom.get_cpath_bbox(item) bbox = libgeom.sum_bbox(bbox, arrow_bbox) bbox = self.presenter.canvas.bbox_doc_to_win(bbox) bbox = libgeom.normalize_bbox(bbox) if not bbox[2] - bbox[0]: bbox[2] += 4 bbox[0] -= 4 if not bbox[3] - bbox[1]: bbox[3] += 4 bbox[1] -= 4 return bbox
def update_bbox(self): self.cache_bbox = libgeom.get_cpath_bbox(self.cache_cpath)