def select_points_by_bbox(self, bbox): ret = [] if libgeom.is_point_in_bbox(self.start_point.point, bbox): ret.append(self.start_point) for item in self.points: if libgeom.is_point_in_bbox(item.point, bbox): ret.append(item) return ret
def _select_at_point(self, point): result = [] doc = self.presenter layers = doc.get_editable_layers() layers.reverse() win_point = doc.canvas.doc_to_win(point) hit_surface = doc.canvas.hit_surface for layer in layers: if result: break objs = [] + layer.childs objs.reverse() for obj in objs: bbox = self._get_fixed_bbox(obj.cache_bbox) d = 0.0 if obj.style[1]: d = doc.canvas.zoom * obj.style[1][1] bbox = libgeom.enlarge_bbox(bbox, d, d) if libgeom.is_point_in_bbox(win_point, bbox): if hit_surface.is_point_into_object(win_point, obj): result.append(obj) break return result
def is_pressed(self, win_point): wpoint = self.canvas.point_doc_to_win(self.get_point()) bbox = libgeom.bbox_for_point(wpoint, config.point_sensitivity_size) return libgeom.is_point_in_bbox(win_point, bbox)
def is_pressed(self, win_point): wpoint = self.canvas.point_doc_to_win(self.point) if not len(wpoint) == 2: wpoint = wpoint[2] bbox = libgeom.bbox_for_point(wpoint, config.point_sensitivity_size) return libgeom.is_point_in_bbox(win_point, bbox)
def is_point_in_layout_bbox(self, point): bbox = self.target.cache_layout_bbox doc_point = self.canvas.win_to_doc(point) inv_trafo = libgeom.invert_trafo(self.target.trafo) doc_point = libgeom.apply_trafo_to_point(doc_point, inv_trafo) return libgeom.is_point_in_bbox(doc_point, bbox)
def is_pressed(self, win_point): wpoint = self.canvas.point_doc_to_win(self.point) if not len(wpoint) == 2:wpoint = wpoint[2] bbox = libgeom.bbox_for_point(wpoint, config.point_sensitivity_size) return libgeom.is_point_in_bbox(win_point, bbox)