Skip to content

Commit 187bc66

Browse files
committed
Add help text on F1, automatically jump to the next item on the bottom
1 parent d8438c3 commit 187bc66

2 files changed

Lines changed: 51 additions & 1 deletion

File tree

MainApplication.tscn

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=24 format=3 uid="uid://dobe3b68py6dw"]
1+
[gd_scene load_steps=25 format=3 uid="uid://dobe3b68py6dw"]
22

33
[ext_resource type="Theme" uid="uid://bbsoqdy0nn2wf" path="res://Application.theme" id="1_wph70"]
44
[ext_resource type="Script" path="res://scripts/ImageScrollManager.gd" id="2_i2scm"]
@@ -206,6 +206,17 @@ func _gui_input(event: InputEvent) -> void:
206206
release_focus()
207207
"
208208

209+
[sub_resource type="GDScript" id="GDScript_3bsag"]
210+
script/source = "extends RichTextLabel
211+
212+
213+
func _input(event: InputEvent) -> void:
214+
if event is InputEventKey:
215+
if not event.pressed:
216+
if event.keycode == KEY_F1:
217+
visible = !visible
218+
"
219+
209220
[node name="MainPanel" type="PanelContainer"]
210221
anchors_preset = 15
211222
anchor_right = 1.0
@@ -391,3 +402,40 @@ layout_mode = 2
391402
alignment = 1
392403
icon_alignment = 1
393404
script = SubResource("GDScript_iyy15")
405+
406+
[node name="MarginContainer" type="MarginContainer" parent="."]
407+
layout_mode = 2
408+
mouse_filter = 2
409+
theme_override_constants/margin_left = 20
410+
theme_override_constants/margin_top = 10
411+
theme_override_constants/margin_right = 20
412+
theme_override_constants/margin_bottom = 10
413+
414+
[node name="Label" type="RichTextLabel" parent="MarginContainer"]
415+
visible = false
416+
layout_mode = 2
417+
size_flags_vertical = 0
418+
mouse_filter = 2
419+
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
420+
theme_override_constants/outline_size = 5
421+
theme_override_font_sizes/normal_font_size = 13
422+
theme_override_font_sizes/bold_font_size = 15
423+
bbcode_enabled = true
424+
text = "[b]Keyboard and Mouse Controls[/b]:
425+
426+
F1 - Toggle this menu
427+
Space / Right - Move to next image
428+
Left - Move to previous image
429+
Q - Rotate image counterclockwise
430+
R - Rotate image clockwise
431+
ESC - Unfocus GUI element
432+
433+
Mouse in the main Area:
434+
435+
Mouse Wheel - Zoom in / out at mouse position
436+
Right Click, Drag - Zoom in / out, x coordinate is a bit slower than y coordinate
437+
Left Click, Pan - Move the selected area
438+
439+
"
440+
fit_content_height = true
441+
script = SubResource("GDScript_3bsag")

scripts/ImageScrollManager.gd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ func _ready() -> void:
2828

2929
resized.connect(func(): old_scroll_position = -1)
3030

31+
Application.active_item_changed.connect(func(item: ProcessedImage): scroll_horizontal = (item.index - (visible_items / 2)) * item_width)
32+
3133
image_update_timer = Timer.new()
3234
image_update_timer.wait_time = 0.25
3335
add_child(image_update_timer)

0 commit comments

Comments
 (0)