Add visual harmonization tests for editor UI components and ground finish chooser
- Implemented `test_editor_visual_harmonization.gd` to validate the Stickman editor and prop editor UI layouts, ensuring proper functionality and visual consistency. - Created `test_editor_visual_theme.gd` to verify the loading and application of visual themes in the editor, including semantic overrides and default values. - Introduced `test_phase19_ground_finish_chooser.gd` to test the ground finish chooser's functionality, including layout responsiveness, selection behavior, and interaction with the stage. - Added new scripts for ground finish preview and chooser UI components to enhance the editor's visual representation of ground finishes.
This commit is contained in:
@@ -121,6 +121,7 @@ var _pan_offset: Vector2 = Vector2.ZERO
|
||||
var _grid_size: int = 15
|
||||
var _snap_enabled: bool = false
|
||||
var _has_clipboard: bool = false
|
||||
var _create_point_armed: bool = false
|
||||
var _context_menu: PopupMenu
|
||||
var _edit_mode: EditMode = EditMode.TRANSFORM
|
||||
var _anchor_overlay: RefCounted
|
||||
@@ -214,6 +215,8 @@ func set_edit_mode(mode: int) -> void:
|
||||
if _stage_size_preview_active:
|
||||
cancel_stage_size_preview()
|
||||
_edit_mode = m
|
||||
if _edit_mode != EditMode.POINTS:
|
||||
_create_point_armed = false
|
||||
if _edit_mode != EditMode.TRANSFORM:
|
||||
set_whole_prop_resize_enabled(false)
|
||||
_drag_mode = DragMode.NONE
|
||||
@@ -225,6 +228,21 @@ func set_edit_mode(mode: int) -> void:
|
||||
func get_edit_mode() -> int:
|
||||
return _edit_mode
|
||||
|
||||
|
||||
func arm_create_point() -> void:
|
||||
set_edit_mode(EditMode.POINTS)
|
||||
_create_point_armed = true
|
||||
queue_redraw()
|
||||
|
||||
|
||||
func cancel_create_point() -> void:
|
||||
_create_point_armed = false
|
||||
queue_redraw()
|
||||
|
||||
|
||||
func is_create_point_armed() -> bool:
|
||||
return _create_point_armed
|
||||
|
||||
func set_anchor_data(data: Variant) -> void:
|
||||
if _anchor_overlay == null: _anchor_overlay = PropAnchorOverlayScript.new()
|
||||
_anchor_overlay.set_anchor_data(data)
|
||||
@@ -1254,7 +1272,10 @@ func _on_canvas_gui_input(event: InputEvent) -> void:
|
||||
return
|
||||
if mb.button_index == MOUSE_BUTTON_LEFT:
|
||||
if mb.pressed:
|
||||
_handle_left_press(world_pos)
|
||||
if _create_point_armed and _edit_mode == EditMode.POINTS:
|
||||
_create_point_from_toolbar(world_pos)
|
||||
else:
|
||||
_handle_left_press(world_pos)
|
||||
else:
|
||||
_handle_left_release()
|
||||
|
||||
@@ -1464,6 +1485,21 @@ func _handle_left_press(world_pos: Vector2) -> void:
|
||||
shape_selected.emit(-1)
|
||||
|
||||
|
||||
func _create_point_from_toolbar(world_pos: Vector2) -> void:
|
||||
var shape_idx: int = hit_test_segment(world_pos)
|
||||
if shape_idx < 0:
|
||||
return
|
||||
_selected_shape_idx = shape_idx
|
||||
shape_selected.emit(shape_idx)
|
||||
var new_vertex_index: int = create_point_on_edge(world_pos)
|
||||
if new_vertex_index < 0:
|
||||
return
|
||||
_create_point_armed = false
|
||||
_drag_mode = DragMode.NONE
|
||||
_emit_changed()
|
||||
queue_redraw()
|
||||
|
||||
|
||||
func _handle_drag_motion(mm: InputEventMouseMotion, world_pos: Vector2, ctrl_pressed: bool) -> void:
|
||||
match _drag_mode:
|
||||
DragMode.VERTEX:
|
||||
|
||||
Reference in New Issue
Block a user