refactor(D.2b): LayoutImporter review fixes — root-fallback trace + cursor-discard note
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bd01a29eb2
commit
9a55a688ca
1 changed files with 8 additions and 3 deletions
|
|
@ -86,8 +86,12 @@ public static class LayoutImporter
|
|||
var byId = new Dictionary<uint, UiElement>();
|
||||
// Root is never a Type-12 prototype in practice; fall back to a generic
|
||||
// container if the factory returns null for an exotic root type.
|
||||
var root = BuildWidget(rootInfo, resolve, datFont, byId)
|
||||
?? new UiDatElement(rootInfo, resolve);
|
||||
var root = BuildWidget(rootInfo, resolve, datFont, byId);
|
||||
if (root is null)
|
||||
{
|
||||
Console.WriteLine($"[D.2b] LayoutImporter: root element 0x{rootInfo.Id:X8} (type {rootInfo.Type}) produced no widget — using empty container fallback.");
|
||||
root = new UiDatElement(rootInfo, resolve);
|
||||
}
|
||||
return new ImportedLayout(root, byId);
|
||||
}
|
||||
|
||||
|
|
@ -228,7 +232,8 @@ public static class LayoutImporter
|
|||
/// </summary>
|
||||
private static void ReadState(StateDesc sd, string name, ElementInfo info)
|
||||
{
|
||||
// First MediaDescImage in this state's Media list wins (format doc §5).
|
||||
// Only MediaDescImage is read for rendering; MediaDescCursor items (on grips/drag bars)
|
||||
// are intentionally skipped — cursor behavior is Plan 2.
|
||||
foreach (var m in sd.Media)
|
||||
{
|
||||
if (m is MediaDescImage img && img.File != 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue