Record original-alignment implementation and traceability checkpoint
Capture current source, content data, tests, asset licenses, and original-specification traceability. Original implementation remains incomplete. The accepted matching UI generation passed 154 suites and 12,253 checks, with eight rendered staff-contract screens reviewed. Latest native Windows and full-original acceptance remain outstanding.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
extends WorldPreview
|
||||
|
||||
# Uncached geometry and reflective service lookup oracle.
|
||||
func get_map_rect() -> Rect2:
|
||||
var bounds := _world_bounds()
|
||||
if bounds.is_empty():
|
||||
return Rect2()
|
||||
var dimensions := _cell_dimensions()
|
||||
var map_size := Vector2(
|
||||
int(bounds[&"max_x"]) - int(bounds[&"min_x"]) + 1,
|
||||
int(bounds[&"max_y"]) - int(bounds[&"min_y"]) + 1
|
||||
) * dimensions
|
||||
return Rect2(((size - map_size) * 0.5 + pan_offset).floor(), map_size)
|
||||
|
||||
|
||||
func _cell_dimensions() -> Vector2:
|
||||
var bounds := _world_bounds()
|
||||
if bounds.is_empty():
|
||||
return Vector2(32, 48)
|
||||
var columns := maxi(int(bounds[&"max_x"]) - int(bounds[&"min_x"]) + 1, 1)
|
||||
var rows := maxi(int(bounds[&"max_y"]) - int(bounds[&"min_y"]) + 1, 1)
|
||||
var available := (size - MAP_PADDING * 2.0).max(Vector2.ONE)
|
||||
var fit := minf(available.x / (columns * 16.0), available.y / (rows * 24.0))
|
||||
# Native 16px units use integer magnification. Large worlds can be viewed
|
||||
# at overview scale, then enlarged with the same invertible camera mapping.
|
||||
var pixel := maxf(floorf(fit), 1.0) if fit >= 1.0 else maxf(fit, 0.25)
|
||||
return (Vector2(16, 24) * pixel * zoom_level).round().max(Vector2(4, 6))
|
||||
|
||||
|
||||
func _service(property_name: StringName) -> Variant:
|
||||
if _runtime == null or not _runtime is Object:
|
||||
return null
|
||||
for property: Dictionary in _runtime.get_property_list():
|
||||
if StringName(property.get(&"name", &"")) == property_name:
|
||||
return _runtime.get(property_name)
|
||||
return null
|
||||
|
||||
|
||||
func _world_bounds() -> Dictionary:
|
||||
var world: Variant = _service(&"world_service")
|
||||
if world == null or not world.has_method(&"get_bounds"):
|
||||
return {}
|
||||
var result: Variant = world.call(&"get_bounds")
|
||||
if not result is Dictionary:
|
||||
return {}
|
||||
for key: StringName in [&"min_x", &"max_x", &"min_y", &"max_y"]:
|
||||
if not result.has(key) and not result.has(String(key)):
|
||||
return {}
|
||||
return {
|
||||
&"min_x": int(result.get(&"min_x", result.get("min_x", 0))),
|
||||
&"max_x": int(result.get(&"max_x", result.get("max_x", -1))),
|
||||
&"min_y": int(result.get(&"min_y", result.get("min_y", 0))),
|
||||
&"max_y": int(result.get(&"max_y", result.get("max_y", -1))),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user