fix touch/no button
This commit is contained in:
1 parent
4bbfefd882
commit
2ac76d5a22
3 files changed
+7
-4
No files matched your search
@@ -379,6 +379,7 @@ class KaTrainGui(Screen, KaTrainBase):
|
||||
or self.board_controls.collide_point(*touch.pos)
|
||||
or self.controls.move_tree.collide_point(*touch.pos)
|
||||
):
|
||||
if touch.is_mouse_scrolling:
|
||||
if touch.button == "scrollup":
|
||||
self("redo")
|
||||
elif touch.button == "scrolldown":
|
||||
|
||||
@@ -60,11 +60,13 @@ class BadukPanWidget(Widget):
|
||||
def on_touch_down(self, touch):
|
||||
self.animating_pv = None # any click kills PV from label/move
|
||||
self.draw_hover_contents()
|
||||
if touch.button != "left":
|
||||
if "button" in touch.profile and touch.button != "left":
|
||||
return
|
||||
self.check_next_move_ghost(touch)
|
||||
|
||||
def on_touch_move(self, touch):
|
||||
if "button" in touch.profile and touch.button != "left":
|
||||
return
|
||||
return self.check_next_move_ghost(touch)
|
||||
|
||||
def on_mouse_pos(self, *args): # https://gist.github.com/opqopq/15c707dc4cffc2b6455f
|
||||
@@ -92,10 +94,10 @@ class BadukPanWidget(Widget):
|
||||
self.last_mouse_pos = pos
|
||||
|
||||
def on_touch_up(self, touch):
|
||||
if touch.button != "left" or not self.gridpos_x:
|
||||
if ("button" in touch.profile and touch.button != "left") or not self.gridpos_x:
|
||||
return
|
||||
katrain = self.katrain
|
||||
if self.ghost_stone and touch.button == "left":
|
||||
if self.ghost_stone and ("button" not in touch.profile or touch.button == "left"):
|
||||
katrain("play", self.ghost_stone)
|
||||
elif not self.ghost_stone:
|
||||
xd, xp = self._find_closest(touch.x, self.gridpos_x)
|
||||
|
||||
@@ -37,7 +37,7 @@ class MoveTreeCanvas(Widget):
|
||||
katrain.update_state()
|
||||
|
||||
def on_touch_up(self, touch):
|
||||
if touch.button == "left":
|
||||
if "button" not in touch.profile or touch.button == "left":
|
||||
node, (x, y) = min(
|
||||
self.move_xy_pos.items(), key=lambda n_xy: abs(n_xy[1][0] - touch.x) + abs(n_xy[1][1] - touch.y)
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user