Fix mouse pointer handling when dragging an image.

This commit is contained in:
Relintai 2022-12-11 12:00:48 +01:00
parent f2814b332d
commit 869568db37
2 changed files with 16 additions and 13 deletions

View File

@ -7,26 +7,26 @@ anchor_right = 1.0
anchor_bottom = 1.0
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_right = 600.0
margin_bottom = 600.0
margin_right = 900.0
margin_bottom = 1000.0
custom_constants/separation = 24
alignment = 1
[node name="Sort" type="Button" parent="VBoxContainer"]
margin_top = 246.0
margin_right = 600.0
margin_bottom = 266.0
margin_top = 446.0
margin_right = 900.0
margin_bottom = 466.0
text = "Sort"
[node name="Settings" type="Button" parent="VBoxContainer"]
margin_top = 290.0
margin_right = 600.0
margin_bottom = 310.0
margin_top = 490.0
margin_right = 900.0
margin_bottom = 510.0
text = "Settings"
[node name="Exit" type="Button" parent="VBoxContainer"]
margin_top = 334.0
margin_right = 600.0
margin_bottom = 354.0
margin_top = 534.0
margin_right = 900.0
margin_bottom = 554.0
text = "Exit"
script = ExtResource( 1 )

View File

@ -38,15 +38,18 @@ func _gui_input(event: InputEvent) -> void:
elif iemb.button_index == BUTTON_WHEEL_DOWN:
_zoom_slider.value -= 0.03
else:
if mouse_down && mouse_pointer != iemb.button_index:
return
mouse_down = iemb.pressed
mouse_pointer == event.button_index
mouse_pointer == iemb.button_index
accept_event()
elif event is InputEventMouseMotion:
var iemm : InputEventMouseMotion = event
if !mouse_down || mouse_pointer != event.device:
if !mouse_down:
return
hscrollbar.value -= iemm.relative.x