def _notify_canvas_observers(self, affected_layers): bbox = helpers.Rect() for layer in affected_layers: layer_bbox = layer.get_bbox() bbox.expandToIncludeRect(layer_bbox) for func in self.doc.canvas_observers: func(*bbox)
def get_bbox(self): res = helpers.Rect() for layer in self.layers: # OPTIMIZE: only visible layers... # careful: currently saving assumes that all layers are included bbox = layer.get_bbox() res.expandToIncludeRect(bbox) return res
def get_bbox(self): """Returns the dynamic bounding box of the document. This is currently the union of all the bounding boxes of all of the layers. It disregards the user-chosen frame. """ res = helpers.Rect() for layer in self.layers: # OPTIMIZE: only visible layers... # careful: currently saving assumes that all layers are included bbox = layer.get_bbox() res.expandToIncludeRect(bbox) return res