Implemented image scroll zoom.

This commit is contained in:
Relintai 2022-12-10 21:16:05 +01:00
parent b222a09ea4
commit cec967f1c1
2 changed files with 9 additions and 2 deletions

View File

@ -33,8 +33,14 @@ func _gui_input(event: InputEvent) -> void:
if event is InputEventMouseButton: if event is InputEventMouseButton:
var iemb : InputEventMouseButton = event var iemb : InputEventMouseButton = event
mouse_down = iemb.pressed if iemb.button_index == BUTTON_WHEEL_UP:
mouse_pointer == event.device _zoom_slider.value += 0.03
elif iemb.button_index == BUTTON_WHEEL_DOWN:
_zoom_slider.value -= 0.03
else:
mouse_down = iemb.pressed
mouse_pointer == event.button_index
accept_event() accept_event()
elif event is InputEventMouseMotion: elif event is InputEventMouseMotion:

View File

@ -18,6 +18,7 @@ size_flags_vertical = 3
[node name="ScrollContainer" type="ScrollContainer" parent="HBoxContainer"] [node name="ScrollContainer" type="ScrollContainer" parent="HBoxContainer"]
margin_right = 880.0 margin_right = 880.0
margin_bottom = 900.0 margin_bottom = 900.0
mouse_filter = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3