Skip to content

Commit f7d3451

Browse files
committed
make None default for keys in mouse events
1 parent de59988 commit f7d3451

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

webgpu/camera.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,12 @@ def set_render_functions(self, redraw_function, get_position_function=None):
212212
self._get_position_function = get_position_function
213213

214214
def register_callbacks(self, input_handler):
215-
input_handler.on_mousedown(self._on_mousedown)
216-
input_handler.on_mouseup(self._on_mouseup)
217-
input_handler.on_mouseout(self._on_mouseup)
218-
input_handler.on_mousemove(self._on_mousemove)
219-
input_handler.on_dblclick(self._on_dblclick)
220-
input_handler.on_wheel(self._on_wheel, shift=None)
215+
input_handler.on_mousedown(self._on_mousedown, ctrl=False)
216+
input_handler.on_mouseup(self._on_mouseup, ctrl=False)
217+
input_handler.on_mouseout(self._on_mouseup, ctrl=False)
218+
input_handler.on_mousemove(self._on_mousemove, ctrl=False)
219+
input_handler.on_dblclick(self._on_dblclick, ctrl=False)
220+
input_handler.on_wheel(self._on_wheel)
221221

222222
def unregister_callbacks(self, input_handler):
223223
input_handler.unregister("mousedown", self._on_mousedown)

webgpu/input_handler.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class InputHandler:
77

88
class Modifiers:
99
def __init__(
10-
self, alt: bool | None = False, shift: bool | None = False, ctrl: bool | None = False
10+
self, alt: bool | None = None, shift: bool | None = None, ctrl: bool | None = None
1111
):
1212
self.alt = alt
1313
self.shift = shift
@@ -61,9 +61,9 @@ def on(
6161
self,
6262
event: str,
6363
func: Callable,
64-
alt: bool | None = False,
65-
shift: bool | None = False,
66-
ctrl: bool | None = False,
64+
alt: bool | None = None,
65+
shift: bool | None = None,
66+
ctrl: bool | None = None,
6767
):
6868
if event not in self._callbacks:
6969
self._callbacks[event] = []
@@ -87,42 +87,42 @@ def emit(self, event: str, ev: dict, *args):
8787
func(ev, *args)
8888

8989
def on_dblclick(
90-
self, func, alt: bool | None = False, shift: bool | None = False, ctrl: bool | None = False
90+
self, func, alt: bool | None = None, shift: bool | None = None, ctrl: bool | None = None
9191
):
9292
self.on("dblclick", func, alt, shift, ctrl)
9393

9494
def on_click(
95-
self, func, alt: bool | None = False, shift: bool | None = False, ctrl: bool | None = False
95+
self, func, alt: bool | None = None, shift: bool | None = None, ctrl: bool | None = None
9696
):
9797
self.on("click", func, alt, shift, ctrl)
9898

9999
def on_mousedown(
100-
self, func, alt: bool | None = False, shift: bool | None = False, ctrl: bool | None = False
100+
self, func, alt: bool | None = None, shift: bool | None = None, ctrl: bool | None = None
101101
):
102102
self.on("mousedown", func, alt, shift, ctrl)
103103

104104
def on_mouseup(
105-
self, func, alt: bool | None = False, shift: bool | None = False, ctrl: bool | None = False
105+
self, func, alt: bool | None = None, shift: bool | None = None, ctrl: bool | None = None
106106
):
107107
self.on("mouseup", func, alt, shift, ctrl)
108108

109109
def on_mouseout(
110-
self, func, alt: bool | None = False, shift: bool | None = False, ctrl: bool | None = False
110+
self, func, alt: bool | None = None, shift: bool | None = None, ctrl: bool | None = None
111111
):
112112
self.on("mouseout", func, alt, shift, ctrl)
113113

114114
def on_wheel(
115-
self, func, alt: bool | None = False, shift: bool | None = False, ctrl: bool | None = False
115+
self, func, alt: bool | None = None, shift: bool | None = None, ctrl: bool | None = None
116116
):
117117
self.on("wheel", func, alt, shift, ctrl)
118118

119119
def on_mousemove(
120-
self, func, alt: bool | None = False, shift: bool | None = False, ctrl: bool | None = False
120+
self, func, alt: bool | None = None, shift: bool | None = None, ctrl: bool | None = None
121121
):
122122
self.on("mousemove", func, alt, shift, ctrl)
123123

124124
def on_drag(
125-
self, func, alt: bool | None = False, shift: bool | None = False, ctrl: bool | None = False
125+
self, func, alt: bool | None = None, shift: bool | None = None, ctrl: bool | None = None
126126
):
127127
self.on("drag", func, alt, shift, ctrl)
128128

0 commit comments

Comments
 (0)