def on_touch_down(self, touch: MotionEvent) -> bool: """ On touch down on connection means we are modifying an already existing connection, not creating a new one. """ # TODO: remove start check? if self.start and self.start.collide_point(*touch.pos): self.forward = False # Remove start edge self._unbind_pin(self.start) self.start.on_connection_delete(self) self.start = None # This signals that we are dragging a connection touch.ud['cur_line'] = self Window.add_widget(self.info) return True elif self.end and self.end.collide_point(*touch.pos): # Same as before but with the other edge self.forward = True self._unbind_pin(self.end) self.end.on_connection_delete(self) self.end = None touch.ud['cur_line'] = self Window.add_widget(self.info) return True else: return False
def on_touch_down(self, touch: MotionEvent): tileTouched, row = self.findTileTouched(touch) if (tileTouched is not None and row is not None): if (touch.button == 'right'): touch.grab(self) self.lastTouchedTile = tileTouched return super().on_touch_down(touch)
def on_touch_down(self, evt: MotionEvent) -> None: if evt.is_mouse_scrolling: shift = _VIEW_SCROLL_ADD if evt.button == "scrolldown" else -_VIEW_SCROLL_ADD if self.__zoom_scale + shift >= 1: self.__zoom_scale += shift self.draw_routes() else: evt.grab(self)
def on_touch_up(self, touch: MotionEvent): if touch.grab_current is not self: return super().on_touch_move(touch) self.moving = False self.initPos = None self.lastDiff = None touch.ungrab(self) return True
def on_touch_down(self, touch: MotionEvent): if super().on_touch_down(touch): return True touch.grab(self) self.moving = True self.initPos = touch.pos self.lastDiff = [0] * 2 return True
def on_touch_up(self, touch: MotionEvent): tileTouched, row = self.findTileTouched(touch) if (tileTouched is not None and row is not None): if (touch.button == "left"): print( tileTouched.coords, self.children.index(row), row.children.index(tileTouched), "WHITE" * self.board.turn + "BLACK" * (not self.board.turn)) self.handleSelection(tileTouched) self.arrowManager.removeArrows() else: self.unselectCase() if (touch.button == "right" and touch.grab_current is self): tileTouched, row = self.findTileTouched(touch) touch.ungrab(self) if (tileTouched is not None and row is not None): self.arrowManager.addArrow(self.lastTouchedTile, tileTouched) return super().on_touch_up(touch)
def on_touch_down(self, touch: MotionEvent) -> bool: if (self.collide_point(*touch.pos) and touch.button == 'left' and not self.destinations): logger.info('Creating connection') touch.ud['cur_line'] = Connection(end=self, color=self.color) self.destinations.append(touch.ud['cur_line']) # Add to blackboard self.block.parent.parent.parent.connections.add_widget( touch.ud['cur_line']) self._circle_pin() return True else: return False
def on_touch_up(self, evt: MotionEvent) -> None: if evt.grab_current is self: evt.ungrab(self)