@@ -218,20 +218,18 @@ func _on_replace_block_code_button_pressed():
218
218
func _input (event ):
219
219
if event is InputEventKey :
220
220
if event .keycode == KEY_SHIFT :
221
- if event .pressed :
222
- _mouse_override .mouse_filter = Control .MOUSE_FILTER_PASS
223
- _mouse_override .mouse_default_cursor_shape = Control .CURSOR_MOVE
224
- else :
225
- _mouse_override .mouse_filter = Control .MOUSE_FILTER_IGNORE
226
- _mouse_override .mouse_default_cursor_shape = Control .CURSOR_ARROW
221
+ set_mouse_override (event .pressed )
227
222
228
223
if event is InputEventMouseButton :
229
- if event .button_index == MOUSE_BUTTON_LEFT :
224
+ if event .button_index == MOUSE_BUTTON_LEFT or event . button_index == MOUSE_BUTTON_MIDDLE :
230
225
if event .pressed and is_mouse_over ():
231
226
_panning = true
232
227
else :
233
228
_panning = false
234
229
230
+ if event .button_index == MOUSE_BUTTON_MIDDLE :
231
+ set_mouse_override (event .pressed )
232
+
235
233
var relative_mouse_pos := get_global_mouse_position () - get_global_rect ().position
236
234
237
235
if is_mouse_over ():
@@ -247,7 +245,7 @@ func _input(event):
247
245
_window .position -= (old_mouse_window_pos - canvas_to_window (relative_mouse_pos )) * _window .scale .x
248
246
249
247
if event is InputEventMouseMotion :
250
- if Input .is_key_pressed (KEY_SHIFT ) and _panning :
248
+ if ( Input .is_key_pressed (KEY_SHIFT ) and _panning ) or ( Input . is_mouse_button_pressed ( MOUSE_BUTTON_MIDDLE ) and _panning ) :
251
249
_window .position += event .relative
252
250
253
251
@@ -261,3 +259,12 @@ func window_to_canvas(v: Vector2) -> Vector2:
261
259
262
260
func is_mouse_over () -> bool :
263
261
return get_global_rect ().has_point (get_global_mouse_position ())
262
+
263
+
264
+ func set_mouse_override (override : bool ):
265
+ if override :
266
+ _mouse_override .mouse_filter = Control .MOUSE_FILTER_PASS
267
+ _mouse_override .mouse_default_cursor_shape = Control .CURSOR_MOVE
268
+ else :
269
+ _mouse_override .mouse_filter = Control .MOUSE_FILTER_IGNORE
270
+ _mouse_override .mouse_default_cursor_shape = Control .CURSOR_ARROW
0 commit comments