fix(editor): move build stamp to bottom, expand palette list, add hover feedback and instructions
checkpoint / checkpoint (push) Successful in 6m5s

This commit is contained in:
2026-09-16 12:21:39 +00:00
parent 42520b33d5
commit 73172b1e28
6 changed files with 195 additions and 28 deletions
+62 -4
View File
@@ -26,6 +26,12 @@ var pending_catalog_id: String = ""
## Tile id the next "brush" click paints. Cycled with number keys 0-9.
var current_tile_id: int = 1
var _hover_tx: int = -1
var _hover_ty: int = -1
var _mouse_down: bool = false
var _last_drag_tx: int = -1
var _last_drag_ty: int = -1
const TILE_EMPTY_COLOR := Color(0.15, 0.15, 0.17)
const TILE_SOLID_COLOR := Color(0.35, 0.55, 0.35)
const GRID_COLOR := Color(0, 0, 0, 0.25)
@@ -39,6 +45,16 @@ func _init() -> void:
focus_mode = Control.FOCUS_ALL
func _notification(what: int) -> void:
if what == NOTIFICATION_MOUSE_EXIT:
_hover_tx = -1
_hover_ty = -1
_mouse_down = false
_last_drag_tx = -1
_last_drag_ty = -1
queue_redraw()
func setup(p_core: EditorCore, p_layer_idx: int = 0) -> void:
core = p_core
layer_idx = p_layer_idx
@@ -76,11 +92,32 @@ func _draw() -> void:
for y in range(layer.height + 1):
draw_line(Vector2(0, y * cell_size), Vector2(layer.width * cell_size, y * cell_size), GRID_COLOR)
# Hover highlight over current cell
if _hover_tx >= 0 and _hover_tx < layer.width and _hover_ty >= 0 and _hover_ty < layer.height:
var h_rect := Rect2(_hover_tx * cell_size, _hover_ty * cell_size, cell_size, cell_size)
draw_rect(h_rect, Color(1.0, 1.0, 1.0, 0.2), true)
draw_rect(h_rect, Color(1.0, 0.95, 0.3, 0.85), false, 2.0)
if core.tools.get_active_tool_id() == "object_place" and pending_catalog_id != "":
var ghost_pos := Vector2((_hover_tx + 0.5) * cell_size, (_hover_ty + 0.5) * cell_size)
draw_circle(ghost_pos, cell_size * 0.35, Color(1.0, 0.8, 0.2, 0.5))
var default_font := ThemeDB.fallback_font
for obj in core.model.payload.objects:
var center := Vector2(obj.position.x * cell_size, obj.position.y * cell_size)
var is_selected: bool = core.selection.get_selected() == obj.id
var color := OBJECT_SELECTED_COLOR if is_selected else OBJECT_COLOR
draw_circle(center, cell_size * 0.3, color)
var r := cell_size * 0.38
draw_circle(center, r, color)
draw_arc(center, r, 0.0, TAU, 16, Color(0, 0, 0, 0.85), 1.5)
if is_selected:
draw_arc(center, r + 3.0, 0.0, TAU, 16, Color(1, 1, 1, 0.95), 2.0)
var display_name: String = ""
if obj.properties is Dictionary and obj.properties.has("display_name"):
display_name = str(obj.properties["display_name"])
if display_name == "":
display_name = obj.id
draw_string(default_font, center + Vector2(-r * 1.5, -r - 2), display_name.left(6), HORIZONTAL_ALIGNMENT_CENTER, int(r * 3.0), 10, Color(1, 1, 1, 0.9))
func _gui_input(event: InputEvent) -> void:
@@ -88,9 +125,27 @@ func _gui_input(event: InputEvent) -> void:
return
if event is InputEventMouseButton:
var mb := event as InputEventMouseButton
if mb.pressed and mb.button_index == MOUSE_BUTTON_LEFT:
_handle_click(mb.position)
accept_event()
if mb.button_index == MOUSE_BUTTON_LEFT:
_mouse_down = mb.pressed
if mb.pressed:
_handle_click(mb.position)
accept_event()
else:
_last_drag_tx = -1
_last_drag_ty = -1
elif event is InputEventMouseMotion:
var mm := event as InputEventMouseMotion
var tx := int(floor(mm.position.x / cell_size))
var ty := int(floor(mm.position.y / cell_size))
if tx != _hover_tx or ty != _hover_ty:
_hover_tx = tx
_hover_ty = ty
queue_redraw()
if _mouse_down and (tx != _last_drag_tx or ty != _last_drag_ty):
var active_tool := core.tools.get_active_tool_id()
if active_tool in ["brush", "erase"]:
_handle_click(mm.position)
accept_event()
elif event is InputEventKey:
var key := event as InputEventKey
if key.pressed and not key.echo:
@@ -105,6 +160,8 @@ func _handle_key(key: InputEventKey) -> void:
func _handle_click(local_pos: Vector2) -> void:
var tx := int(floor(local_pos.x / cell_size))
var ty := int(floor(local_pos.y / cell_size))
_last_drag_tx = tx
_last_drag_ty = ty
match core.tools.get_active_tool_id():
"brush":
@@ -125,6 +182,7 @@ func _handle_click(local_pos: Vector2) -> void:
queue_redraw()
"select":
core.select_object(_object_at(tx, ty))
edit_applied.emit()
queue_redraw()