def drag_start(self, event): if self.component: self.original_padding = self.component.padding if hasattr(event, "bid"): event.window.capture_blob(self, event.bid, event.net_transform()) else: event.window.set_mouse_owner(self, event.net_transform()) self._last_blob_pos = (event.x, event.y) self.mouse_down_position = (event.x,event.y) self.event_state = "dragging" event.handled = True ViewportPanTool.drag_start(self, event) return
def _viewport_default(self): """ Trait initialiser """ vp = Viewport(component=self.diagram_canvas, enable_zoom=True) vp.view_position = [0, 0] vp.tools.append(ViewportPanTool(vp)) return vp
def _vp_default(self): """ Trait initialiser. """ vp = Viewport(component=self.component) vp.enable_zoom = True vp.tools.append(ViewportPanTool(vp)) return vp
def drag_end(self, event): event.x, event.y = self._last_blob_pos if hasattr(event, "bid"): event.window.release_blob(event.bid) self.event_state = "normal" ViewportPanTool.drag_end(self, event)
def _viewport_default(self): """ Trait initialiser """ viewport = Viewport(component=self.canvas, enable_zoom=True) viewport.tools.append(ViewportPanTool(viewport)) return viewport