feat: complete mobile UI implementation

This commit is contained in:
shenlei
2026-09-04 19:54:33 +09:00
parent 9a4a044da5
commit b19d5b5dd3
132 changed files with 6643 additions and 180 deletions
+48
View File
@@ -67,6 +67,54 @@ func _run() -> void:
drag.position = Vector2(140, 120)
atlas._on_map_input(drag)
_ck(atlas._map.position != old_pos, "atlas left drag moves map")
# 移动端地图用单指平移;第二根手指出现后,当前拖动必须被冻结,不能
# 把双指手势继续解释成地图移动或世界点地。
atlas._recenter_map()
var single_down := InputEventScreenTouch.new()
single_down.index = 4
single_down.pressed = true
single_down.position = Vector2(120, 120)
atlas._on_map_input(single_down)
var single_drag := InputEventScreenDrag.new()
single_drag.index = 4
single_drag.position = Vector2(160, 145)
single_drag.relative = Vector2(40, 25)
atlas._on_map_input(single_drag)
_ck(atlas._map.position != atlas._map_origin, "atlas single-finger touch drag moves map")
var single_up := InputEventScreenTouch.new()
single_up.index = 4
single_up.pressed = false
single_up.position = single_drag.position
atlas._on_map_input(single_up)
atlas._recenter_map()
var first_down := InputEventScreenTouch.new()
first_down.index = 5
first_down.pressed = true
first_down.position = Vector2(120, 120)
atlas._on_map_input(first_down)
var second_down := InputEventScreenTouch.new()
second_down.index = 6
second_down.pressed = true
second_down.position = Vector2(300, 120)
atlas._on_map_input(second_down)
var before_two_finger_drag: Vector2 = atlas._map.position
var two_finger_drag := InputEventScreenDrag.new()
two_finger_drag.index = 5
two_finger_drag.position = Vector2(220, 220)
two_finger_drag.relative = Vector2(100, 100)
atlas._on_map_input(two_finger_drag)
_ck(atlas._map.position == before_two_finger_drag,
"two-finger map gesture does not pan from one finger")
var first_up := InputEventScreenTouch.new()
first_up.index = 5
first_up.pressed = false
first_up.position = two_finger_drag.position
atlas._on_map_input(first_up)
var second_up := InputEventScreenTouch.new()
second_up.index = 6
second_up.pressed = false
second_up.position = Vector2(300, 120)
atlas._on_map_input(second_up)
var reset := InputEventMouseButton.new()
reset.button_index = MOUSE_BUTTON_RIGHT
reset.pressed = true