fix(client): address PR #36 re-review — 7 items from Hoshe + Tyre
Warnings: facing indicator tests use Godot-normalized rotation range (-PI, PI] instead of raw addition (SW/W/NW in test_rendering, West in test_client_p3). Suggestions: cache font in world_radial _draw(), fix docstring on deactivate_insert() trigger, document tile-coordinate system on _eval_player_near (D-066), add public reset_facing_state() to InputMapper (D-030 testability). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,8 +5,8 @@ extends Control
|
||||
## Renders on InsertOverlay (CanvasLayer 10).
|
||||
## Drag-release for power users, click-click for newcomers.
|
||||
## Insert spoke sends PauseSimulation on activate (#518/D-058).
|
||||
## Selecting any other spoke (or re-opening the radial) calls deactivate_insert()
|
||||
## which sends ResumeSimulation. Pause/resume are idempotent.
|
||||
## Selecting any non-Insert spoke, cancelling, or pressing Escape calls
|
||||
## deactivate_insert() which sends ResumeSimulation. Pause/resume are idempotent.
|
||||
|
||||
signal spoke_selected(spoke_name: String)
|
||||
|
||||
@@ -37,6 +37,7 @@ var _origin: Vector2 = Vector2.ZERO
|
||||
var _hovered_spoke: int = Spoke.NONE
|
||||
var _drag_mode: bool = false
|
||||
var _insert_active: bool = false
|
||||
var _cached_font: Font = null
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -45,6 +46,7 @@ func _ready() -> void:
|
||||
size = custom_minimum_size
|
||||
visible = false
|
||||
mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
_cached_font = get_theme_default_font()
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
@@ -192,10 +194,9 @@ func _draw() -> void:
|
||||
|
||||
# Label
|
||||
var label: String = SPOKE_NAMES.get(spoke, "")
|
||||
var font := get_theme_default_font()
|
||||
var text_size := font.get_string_size(label, HORIZONTAL_ALIGNMENT_CENTER, -1, 11)
|
||||
var text_size := _cached_font.get_string_size(label, HORIZONTAL_ALIGNMENT_CENTER, -1, 11)
|
||||
var label_pos := icon_center + Vector2(-text_size.x / 2.0, ICON_SIZE + 14.0)
|
||||
draw_string(font, label_pos, label, HORIZONTAL_ALIGNMENT_LEFT, -1, 11, color)
|
||||
draw_string(_cached_font, label_pos, label, HORIZONTAL_ALIGNMENT_LEFT, -1, 11, color)
|
||||
|
||||
|
||||
func _draw_spoke_icon(spoke: int, center: Vector2, color: Color) -> void:
|
||||
|
||||
Reference in New Issue
Block a user