fix(editor): move build stamp to bottom, expand palette list, add hover feedback and instructions
checkpoint / checkpoint (push) Successful in 6m5s
checkpoint / checkpoint (push) Successful in 6m5s
This commit is contained in:
@@ -8,11 +8,11 @@ signal tool_selected(tool_id: String)
|
||||
signal undo_pressed
|
||||
signal redo_pressed
|
||||
|
||||
const TOOL_LABELS := {
|
||||
"select": "Select",
|
||||
"brush": "Brush",
|
||||
"object_place": "Place",
|
||||
"erase": "Erase",
|
||||
const TOOL_CONFIG := {
|
||||
"brush": {"label": "Brush (B)", "tooltip": "Paint solid ground tiles (drag to paint; 0-9 for tile types)"},
|
||||
"select": {"label": "Select (V)", "tooltip": "Select and inspect placed objects"},
|
||||
"object_place": {"label": "Place (P)", "tooltip": "Place objects from the Palette onto the grid"},
|
||||
"erase": {"label": "Erase (X)", "tooltip": "Erase tiles or objects (drag to erase)"},
|
||||
}
|
||||
|
||||
var _tool_buttons: Dictionary = {}
|
||||
@@ -25,9 +25,11 @@ func _init() -> void:
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
for tool_id in TOOL_LABELS:
|
||||
for tool_id in TOOL_CONFIG:
|
||||
var btn := Button.new()
|
||||
btn.text = TOOL_LABELS[tool_id]
|
||||
var cfg: Dictionary = TOOL_CONFIG[tool_id]
|
||||
btn.text = cfg["label"]
|
||||
btn.tooltip_text = cfg["tooltip"]
|
||||
btn.toggle_mode = true
|
||||
btn.pressed.connect(_on_tool_button_pressed.bind(tool_id))
|
||||
add_child(btn)
|
||||
@@ -36,12 +38,16 @@ func _ready() -> void:
|
||||
add_child(VSeparator.new())
|
||||
|
||||
_undo_button = Button.new()
|
||||
_undo_button.text = "Undo"
|
||||
_undo_button.text = "Undo (Ctrl+Z)"
|
||||
_undo_button.tooltip_text = "Undo last action"
|
||||
_undo_button.disabled = true
|
||||
_undo_button.pressed.connect(func(): undo_pressed.emit())
|
||||
add_child(_undo_button)
|
||||
|
||||
_redo_button = Button.new()
|
||||
_redo_button.text = "Redo"
|
||||
_redo_button.text = "Redo (Ctrl+Y)"
|
||||
_redo_button.tooltip_text = "Redo last undone action"
|
||||
_redo_button.disabled = true
|
||||
_redo_button.pressed.connect(func(): redo_pressed.emit())
|
||||
add_child(_redo_button)
|
||||
|
||||
@@ -54,7 +60,15 @@ func _on_tool_button_pressed(tool_id: String) -> void:
|
||||
## Reflect the active tool in the button states without re-emitting the signal.
|
||||
func set_active_tool(tool_id: String) -> void:
|
||||
for id in _tool_buttons:
|
||||
_tool_buttons[id].button_pressed = (id == tool_id)
|
||||
var btn: Button = _tool_buttons[id]
|
||||
var is_active: bool = (str(id) == tool_id)
|
||||
btn.button_pressed = is_active
|
||||
if is_active:
|
||||
btn.add_theme_color_override("font_color", Color(1.0, 0.95, 0.3))
|
||||
btn.add_theme_color_override("font_pressed_color", Color(1.0, 0.95, 0.3))
|
||||
else:
|
||||
btn.remove_theme_color_override("font_color")
|
||||
btn.remove_theme_color_override("font_pressed_color")
|
||||
|
||||
|
||||
## Reflect whether undo/redo currently have anything to do.
|
||||
|
||||
Reference in New Issue
Block a user