Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

refactor(ui): retire UIRect, unify UI layout on the UINode CSS box (REARCH_GUI F3)

esengine84eec24c8cf4
diff --git a/desktop/public/scenes/space-shooter.esscene b/desktop/public/scenes/space-shooter.esscene
index a05d169d8..ea392570d 100644
--- a/desktop/public/scenes/space-shooter.esscene
+++ b/desktop/public/scenes/space-shooter.esscene
@@ -129,25 +129,8 @@
}
},
{
- "type": "UIRect",
- "data": {
- "anchorMin": {
- "x": 0.5,
- "y": 0.5
- },
- "anchorMax": {
- "x": 0.5,
- "y": 0.5
- },
- "size": {
- "x": 600,
- "y": 1080
- },
- "pivot": {
- "x": 0.5,
- "y": 0.5
- }
- }
+ "type": "UINode",
+ "data": {}
}
],
"visible": true
@@ -163,27 +146,32 @@
"data": {}
},
{
- "type": "UIRect",
+ "type": "UINode",
"data": {
- "anchorMin": {
- "x": 0,
- "y": 1
+ "position": 1,
+ "width": {
+ "value": 200.0,
+ "unit": 0
},
- "anchorMax": {
- "x": 0,
- "y": 1
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
},
- "offsetMin": {
- "x": 20,
- "y": -40
+ "marginLeft": {
+ "value": 20.0,
+ "unit": 0
},
- "size": {
- "x": 200,
- "y": 40
+ "height": {
+ "value": 40.0,
+ "unit": 0
},
- "pivot": {
- "x": 0,
- "y": 1
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 40.0,
+ "unit": 0
}
}
},
@@ -226,27 +214,32 @@
}
},
{
- "type": "UIRect",
+ "type": "UINode",
"data": {
- "anchorMin": {
- "x": 1,
- "y": 1
+ "position": 1,
+ "width": {
+ "value": 24.0,
+ "unit": 0
},
- "anchorMax": {
- "x": 1,
- "y": 1
+ "insetLeft": {
+ "value": 100.0,
+ "unit": 1
},
- "offsetMin": {
- "x": -84,
- "y": -20
+ "marginLeft": {
+ "value": -108.0,
+ "unit": 0
},
- "size": {
- "x": 24,
- "y": 24
+ "height": {
+ "value": 24.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
},
- "pivot": {
- "x": 1,
- "y": 1
+ "marginTop": {
+ "value": 20.0,
+ "unit": 0
}
}
},
@@ -286,27 +279,32 @@
}
},
{
- "type": "UIRect",
+ "type": "UINode",
"data": {
- "anchorMin": {
- "x": 1,
- "y": 1
+ "position": 1,
+ "width": {
+ "value": 24.0,
+ "unit": 0
},
- "anchorMax": {
- "x": 1,
- "y": 1
+ "insetLeft": {
+ "value": 100.0,
+ "unit": 1
},
- "offsetMin": {
- "x": -52,
- "y": -20
+ "marginLeft": {
+ "value": -76.0,
+ "unit": 0
},
- "size": {
- "x": 24,
- "y": 24
+ "height": {
+ "value": 24.0,
+ "unit": 0
},
- "pivot": {
- "x": 1,
- "y": 1
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 20.0,
+ "unit": 0
}
}
},
@@ -346,27 +344,32 @@
}
},
{
- "type": "UIRect",
+ "type": "UINode",
"data": {
- "anchorMin": {
- "x": 1,
- "y": 1
+ "position": 1,
+ "width": {
+ "value": 24.0,
+ "unit": 0
},
- "anchorMax": {
- "x": 1,
- "y": 1
+ "insetLeft": {
+ "value": 100.0,
+ "unit": 1
},
- "offsetMin": {
- "x": -20,
- "y": -20
+ "marginLeft": {
+ "value": -44.0,
+ "unit": 0
},
- "size": {
- "x": 24,
- "y": 24
+ "height": {
+ "value": 24.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
},
- "pivot": {
- "x": 1,
- "y": 1
+ "marginTop": {
+ "value": 20.0,
+ "unit": 0
}
}
},
@@ -400,27 +403,32 @@
"data": {}
},
{
- "type": "UIRect",
+ "type": "UINode",
"data": {
- "anchorMin": {
- "x": 0.5,
- "y": 0.5
+ "position": 1,
+ "width": {
+ "value": 400.0,
+ "unit": 0
},
- "anchorMax": {
- "x": 0.5,
- "y": 0.5
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
},
- "offsetMin": {
- "x": 0,
- "y": 0
+ "marginLeft": {
+ "value": -200.0,
+ "unit": 0
},
- "size": {
- "x": 400,
- "y": 120
+ "height": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
},
- "pivot": {
- "x": 0.5,
- "y": 0.5
+ "marginTop": {
+ "value": -60.0,
+ "unit": 0
}
}
},
diff --git a/desktop/public/scenes/ui-layout.esscene b/desktop/public/scenes/ui-layout.esscene
index 756c1337d..080dc88b6 100644
--- a/desktop/public/scenes/ui-layout.esscene
+++ b/desktop/public/scenes/ui-layout.esscene
@@ -11,7 +11,11 @@
{
"type": "Transform",
"data": {
- "position": { "x": 0, "y": 0, "z": 10 }
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 10
+ }
}
},
{
@@ -30,24 +34,49 @@
"id": 1,
"name": "Canvas",
"parent": null,
- "children": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24],
+ "children": [
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24
+ ],
"components": [
- { "type": "Transform", "data": {} },
+ {
+ "type": "Transform",
+ "data": {}
+ },
{
"type": "Canvas",
"data": {
- "designResolution": { "x": 800, "y": 600 },
+ "designResolution": {
+ "x": 800,
+ "y": 600
+ },
"scaleMode": 2
}
},
{
- "type": "UIRect",
- "data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "size": { "x": 800, "y": 600 },
- "pivot": { "x": 0.5, "y": 0.5 }
- }
+ "type": "UINode",
+ "data": {}
}
],
"visible": true
@@ -58,15 +87,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 1 },
- "anchorMax": { "x": 0.5, "y": 1 },
- "offsetMin": { "x": 0, "y": -40 },
- "size": { "x": 400, "y": 40 },
- "pivot": { "x": 0.5, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 400.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -200.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 40.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 40.0,
+ "unit": 0
+ }
}
},
{
@@ -74,7 +126,12 @@
"data": {
"content": "UIRect Anchor Layout",
"fontSize": 28,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -88,21 +145,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 10, "y": -10 },
- "size": { "x": 180, "y": 120 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 180.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 10.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 10.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.2, "g": 0.4, "b": 0.7, "a": 0.8 }
+ "color": {
+ "r": 0.2,
+ "g": 0.4,
+ "b": 0.7,
+ "a": 0.8
+ }
}
}
],
@@ -114,15 +199,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 10, "y": -10 },
- "size": { "x": 180, "y": 120 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 180.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 10.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 10.0,
+ "unit": 0
+ }
}
},
{
@@ -130,7 +238,12 @@
"data": {
"content": "Top-Left",
"fontSize": 16,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -144,21 +257,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 1, "y": 1 },
- "anchorMax": { "x": 1, "y": 1 },
- "offsetMin": { "x": -10, "y": -10 },
- "size": { "x": 180, "y": 120 },
- "pivot": { "x": 1, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 180.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 100.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -190.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 10.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.7, "g": 0.2, "b": 0.4, "a": 0.8 }
+ "color": {
+ "r": 0.7,
+ "g": 0.2,
+ "b": 0.4,
+ "a": 0.8
+ }
}
}
],
@@ -170,15 +311,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 1, "y": 1 },
- "anchorMax": { "x": 1, "y": 1 },
- "offsetMin": { "x": -10, "y": -10 },
- "size": { "x": 180, "y": 120 },
- "pivot": { "x": 1, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 180.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 100.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -190.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 10.0,
+ "unit": 0
+ }
}
},
{
@@ -186,7 +350,12 @@
"data": {
"content": "Top-Right",
"fontSize": 16,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -200,21 +369,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0 },
- "anchorMax": { "x": 1, "y": 0 },
- "offsetMin": { "x": 10, "y": 10 },
- "size": { "x": 780, "y": 80 },
- "pivot": { "x": 0.5, "y": 0 }
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 10.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 80.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 100.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -90.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.2, "g": 0.6, "b": 0.3, "a": 0.8 }
+ "color": {
+ "r": 0.2,
+ "g": 0.6,
+ "b": 0.3,
+ "a": 0.8
+ }
}
}
],
@@ -226,15 +423,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0 },
- "anchorMax": { "x": 1, "y": 0 },
- "offsetMin": { "x": 10, "y": 10 },
- "size": { "x": 780, "y": 80 },
- "pivot": { "x": 0.5, "y": 0 }
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 10.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 80.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 100.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -90.0,
+ "unit": 0
+ }
}
},
{
@@ -242,7 +462,12 @@
"data": {
"content": "Bottom Stretch",
"fontSize": 16,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -256,21 +481,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 0, "y": 0 },
- "size": { "x": 200, "y": 150 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 200.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -100.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 150.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -75.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.6, "g": 0.4, "b": 0.2, "a": 0.8 }
+ "color": {
+ "r": 0.6,
+ "g": 0.4,
+ "b": 0.2,
+ "a": 0.8
+ }
}
}
],
@@ -282,15 +535,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 0, "y": 0 },
- "size": { "x": 200, "y": 150 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 200.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -100.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 150.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -75.0,
+ "unit": 0
+ }
}
},
{
@@ -298,7 +574,12 @@
"data": {
"content": "Center",
"fontSize": 16,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -312,21 +593,45 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0.15 },
- "anchorMax": { "x": 0, "y": 0.85 },
- "offsetMin": { "x": 200, "y": 0 },
- "size": { "x": 120, "y": 300 },
- "pivot": { "x": 0, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 200.0,
+ "unit": 0
+ },
+ "insetBottom": {
+ "value": 15.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 15.0,
+ "unit": 1
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.5, "g": 0.2, "b": 0.6, "a": 0.8 }
+ "color": {
+ "r": 0.5,
+ "g": 0.2,
+ "b": 0.6,
+ "a": 0.8
+ }
}
}
],
@@ -338,15 +643,34 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0.15 },
- "anchorMax": { "x": 0, "y": 0.85 },
- "offsetMin": { "x": 200, "y": 0 },
- "size": { "x": 120, "y": 300 },
- "pivot": { "x": 0, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 200.0,
+ "unit": 0
+ },
+ "insetBottom": {
+ "value": 15.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 15.0,
+ "unit": 1
+ }
}
},
{
@@ -354,7 +678,12 @@
"data": {
"content": "Left Stretch",
"fontSize": 16,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -368,21 +697,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 430, "y": -195 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 430.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 195.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.85, "g": 0.15, "b": 0.15, "a": 0.9 }
+ "color": {
+ "r": 0.85,
+ "g": 0.15,
+ "b": 0.15,
+ "a": 0.9
+ }
}
}
],
@@ -394,21 +751,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 493, "y": -195 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 493.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 195.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.85, "g": 0.5, "b": 0.15, "a": 0.9 }
+ "color": {
+ "r": 0.85,
+ "g": 0.5,
+ "b": 0.15,
+ "a": 0.9
+ }
}
}
],
@@ -420,21 +805,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 556, "y": -195 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 556.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 195.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.85, "g": 0.85, "b": 0.15, "a": 0.9 }
+ "color": {
+ "r": 0.85,
+ "g": 0.85,
+ "b": 0.15,
+ "a": 0.9
+ }
}
}
],
@@ -446,21 +859,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 619, "y": -195 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 619.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 195.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.5, "g": 0.85, "b": 0.15, "a": 0.9 }
+ "color": {
+ "r": 0.5,
+ "g": 0.85,
+ "b": 0.15,
+ "a": 0.9
+ }
}
}
],
@@ -472,21 +913,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 430, "y": -258 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 430.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 258.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.15, "g": 0.85, "b": 0.15, "a": 0.9 }
+ "color": {
+ "r": 0.15,
+ "g": 0.85,
+ "b": 0.15,
+ "a": 0.9
+ }
}
}
],
@@ -498,21 +967,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 493, "y": -258 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 493.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 258.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.15, "g": 0.85, "b": 0.5, "a": 0.9 }
+ "color": {
+ "r": 0.15,
+ "g": 0.85,
+ "b": 0.5,
+ "a": 0.9
+ }
}
}
],
@@ -524,21 +1021,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 556, "y": -258 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 556.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 258.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.15, "g": 0.85, "b": 0.85, "a": 0.9 }
+ "color": {
+ "r": 0.15,
+ "g": 0.85,
+ "b": 0.85,
+ "a": 0.9
+ }
}
}
],
@@ -550,21 +1075,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 619, "y": -258 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 619.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 258.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.15, "g": 0.5, "b": 0.85, "a": 0.9 }
+ "color": {
+ "r": 0.15,
+ "g": 0.5,
+ "b": 0.85,
+ "a": 0.9
+ }
}
}
],
@@ -576,21 +1129,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 430, "y": -321 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 430.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 321.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.15, "g": 0.15, "b": 0.85, "a": 0.9 }
+ "color": {
+ "r": 0.15,
+ "g": 0.15,
+ "b": 0.85,
+ "a": 0.9
+ }
}
}
],
@@ -602,21 +1183,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 493, "y": -321 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 493.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 321.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.5, "g": 0.15, "b": 0.85, "a": 0.9 }
+ "color": {
+ "r": 0.5,
+ "g": 0.15,
+ "b": 0.85,
+ "a": 0.9
+ }
}
}
],
@@ -628,21 +1237,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 556, "y": -321 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 556.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 321.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.85, "g": 0.15, "b": 0.85, "a": 0.9 }
+ "color": {
+ "r": 0.85,
+ "g": 0.15,
+ "b": 0.85,
+ "a": 0.9
+ }
}
}
],
@@ -654,21 +1291,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 619, "y": -321 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 619.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 321.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.85, "g": 0.15, "b": 0.5, "a": 0.9 }
+ "color": {
+ "r": 0.85,
+ "g": 0.15,
+ "b": 0.5,
+ "a": 0.9
+ }
}
}
],
diff --git a/desktop/public/scenes/ui-node-absolute.esscene b/desktop/public/scenes/ui-node-absolute.esscene
index 7fe19c24f..22a6626db 100644
--- a/desktop/public/scenes/ui-node-absolute.esscene
+++ b/desktop/public/scenes/ui-node-absolute.esscene
@@ -8,8 +8,25 @@
"parent": null,
"children": [],
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 10 } } },
- { "type": "Camera", "data": { "projectionType": 1, "orthoSize": 300, "isActive": true, "priority": 0 } }
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 10
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 300,
+ "isActive": true,
+ "priority": 0
+ }
+ }
],
"visible": true
},
@@ -17,11 +34,28 @@
"id": 1,
"name": "Canvas",
"parent": null,
- "children": [2],
+ "children": [
+ 2
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "Canvas", "data": { "designResolution": { "x": 800, "y": 600 }, "scaleMode": 2 } },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "size": { "x": 800, "y": 600 }, "pivot": { "x": 0.5, "y": 0.5 } } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "Canvas",
+ "data": {
+ "designResolution": {
+ "x": 800,
+ "y": 600
+ },
+ "scaleMode": 2
+ }
+ },
+ {
+ "type": "UINode",
+ "data": {}
+ }
],
"visible": true
},
@@ -29,11 +63,42 @@
"id": 2,
"name": "Panel",
"parent": 1,
- "children": [3, 4, 5],
+ "children": [
+ 3,
+ 4,
+ 5
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UINode", "data": { "width": { "value": 100, "unit": 1 }, "height": { "value": 100, "unit": 1 } } },
- { "type": "UIRenderer", "data": { "visualType": 1, "color": { "r": 0.12, "g": 0.12, "b": 0.15, "a": 1 }, "enabled": true } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "width": {
+ "value": 100,
+ "unit": 1
+ },
+ "height": {
+ "value": 100,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "UIRenderer",
+ "data": {
+ "visualType": 1,
+ "color": {
+ "r": 0.12,
+ "g": 0.12,
+ "b": 0.15,
+ "a": 1
+ },
+ "enabled": true
+ }
+ }
],
"visible": true
},
@@ -43,9 +108,45 @@
"parent": 2,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UINode", "data": { "position": 1, "insetTop": { "value": 20, "unit": 0 }, "insetLeft": { "value": 20, "unit": 0 }, "width": { "value": 160, "unit": 0 }, "height": { "value": 100, "unit": 0 } } },
- { "type": "UIRenderer", "data": { "visualType": 1, "color": { "r": 0.85, "g": 0.25, "b": 0.25, "a": 1 }, "enabled": true } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "insetTop": {
+ "value": 20,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 20,
+ "unit": 0
+ },
+ "width": {
+ "value": 160,
+ "unit": 0
+ },
+ "height": {
+ "value": 100,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "UIRenderer",
+ "data": {
+ "visualType": 1,
+ "color": {
+ "r": 0.85,
+ "g": 0.25,
+ "b": 0.25,
+ "a": 1
+ },
+ "enabled": true
+ }
+ }
],
"visible": true
},
@@ -55,9 +156,45 @@
"parent": 2,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UINode", "data": { "position": 1, "insetTop": { "value": 20, "unit": 0 }, "insetRight": { "value": 20, "unit": 0 }, "width": { "value": 160, "unit": 0 }, "height": { "value": 100, "unit": 0 } } },
- { "type": "UIRenderer", "data": { "visualType": 1, "color": { "r": 0.25, "g": 0.8, "b": 0.35, "a": 1 }, "enabled": true } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "insetTop": {
+ "value": 20,
+ "unit": 0
+ },
+ "insetRight": {
+ "value": 20,
+ "unit": 0
+ },
+ "width": {
+ "value": 160,
+ "unit": 0
+ },
+ "height": {
+ "value": 100,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "UIRenderer",
+ "data": {
+ "visualType": 1,
+ "color": {
+ "r": 0.25,
+ "g": 0.8,
+ "b": 0.35,
+ "a": 1
+ },
+ "enabled": true
+ }
+ }
],
"visible": true
},
@@ -67,9 +204,45 @@
"parent": 2,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UINode", "data": { "position": 1, "insetLeft": { "value": 0, "unit": 0 }, "insetRight": { "value": 0, "unit": 0 }, "insetBottom": { "value": 0, "unit": 0 }, "height": { "value": 80, "unit": 0 } } },
- { "type": "UIRenderer", "data": { "visualType": 1, "color": { "r": 0.3, "g": 0.45, "b": 0.9, "a": 1 }, "enabled": true } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "insetLeft": {
+ "value": 0,
+ "unit": 0
+ },
+ "insetRight": {
+ "value": 0,
+ "unit": 0
+ },
+ "insetBottom": {
+ "value": 0,
+ "unit": 0
+ },
+ "height": {
+ "value": 80,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "UIRenderer",
+ "data": {
+ "visualType": 1,
+ "color": {
+ "r": 0.3,
+ "g": 0.45,
+ "b": 0.9,
+ "a": 1
+ },
+ "enabled": true
+ }
+ }
],
"visible": true
}
diff --git a/desktop/public/scenes/ui-node-flex.esscene b/desktop/public/scenes/ui-node-flex.esscene
index 8e4913739..24263ce0f 100644
--- a/desktop/public/scenes/ui-node-flex.esscene
+++ b/desktop/public/scenes/ui-node-flex.esscene
@@ -8,8 +8,25 @@
"parent": null,
"children": [],
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 10 } } },
- { "type": "Camera", "data": { "projectionType": 1, "orthoSize": 300, "isActive": true, "priority": 0 } }
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 10
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 300,
+ "isActive": true,
+ "priority": 0
+ }
+ }
],
"visible": true
},
@@ -17,11 +34,28 @@
"id": 1,
"name": "Canvas",
"parent": null,
- "children": [2],
+ "children": [
+ 2
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "Canvas", "data": { "designResolution": { "x": 800, "y": 600 }, "scaleMode": 2 } },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "size": { "x": 800, "y": 600 }, "pivot": { "x": 0.5, "y": 0.5 } } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "Canvas",
+ "data": {
+ "designResolution": {
+ "x": 800,
+ "y": 600
+ },
+ "scaleMode": 2
+ }
+ },
+ {
+ "type": "UINode",
+ "data": {}
+ }
],
"visible": true
},
@@ -29,12 +63,54 @@
"id": 2,
"name": "Row",
"parent": 1,
- "children": [3, 4, 5],
+ "children": [
+ 3,
+ 4,
+ 5
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UINode", "data": { "width": { "value": 600, "unit": 0 }, "height": { "value": 200, "unit": 0 } } },
- { "type": "FlexContainer", "data": { "direction": 0, "justifyContent": 1, "alignItems": 1, "gap": { "x": 20, "y": 0 } } },
- { "type": "UIRenderer", "data": { "visualType": 1, "color": { "r": 0.15, "g": 0.15, "b": 0.18, "a": 1 }, "enabled": true } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "width": {
+ "value": 600,
+ "unit": 0
+ },
+ "height": {
+ "value": 200,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "FlexContainer",
+ "data": {
+ "direction": 0,
+ "justifyContent": 1,
+ "alignItems": 1,
+ "gap": {
+ "x": 20,
+ "y": 0
+ }
+ }
+ },
+ {
+ "type": "UIRenderer",
+ "data": {
+ "visualType": 1,
+ "color": {
+ "r": 0.15,
+ "g": 0.15,
+ "b": 0.18,
+ "a": 1
+ },
+ "enabled": true
+ }
+ }
],
"visible": true
},
@@ -44,9 +120,36 @@
"parent": 2,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UINode", "data": { "width": { "value": 120, "unit": 0 }, "height": { "value": 120, "unit": 0 } } },
- { "type": "UIRenderer", "data": { "visualType": 1, "color": { "r": 0.85, "g": 0.25, "b": 0.25, "a": 1 }, "enabled": true } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "width": {
+ "value": 120,
+ "unit": 0
+ },
+ "height": {
+ "value": 120,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "UIRenderer",
+ "data": {
+ "visualType": 1,
+ "color": {
+ "r": 0.85,
+ "g": 0.25,
+ "b": 0.25,
+ "a": 1
+ },
+ "enabled": true
+ }
+ }
],
"visible": true
},
@@ -56,9 +159,36 @@
"parent": 2,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UINode", "data": { "width": { "value": 120, "unit": 0 }, "height": { "value": 160, "unit": 0 } } },
- { "type": "UIRenderer", "data": { "visualType": 1, "color": { "r": 0.25, "g": 0.8, "b": 0.35, "a": 1 }, "enabled": true } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "width": {
+ "value": 120,
+ "unit": 0
+ },
+ "height": {
+ "value": 160,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "UIRenderer",
+ "data": {
+ "visualType": 1,
+ "color": {
+ "r": 0.25,
+ "g": 0.8,
+ "b": 0.35,
+ "a": 1
+ },
+ "enabled": true
+ }
+ }
],
"visible": true
},
@@ -68,9 +198,36 @@
"parent": 2,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UINode", "data": { "width": { "value": 120, "unit": 0 }, "height": { "value": 80, "unit": 0 } } },
- { "type": "UIRenderer", "data": { "visualType": 1, "color": { "r": 0.3, "g": 0.45, "b": 0.9, "a": 1 }, "enabled": true } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "width": {
+ "value": 120,
+ "unit": 0
+ },
+ "height": {
+ "value": 80,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "UIRenderer",
+ "data": {
+ "visualType": 1,
+ "color": {
+ "r": 0.3,
+ "g": 0.45,
+ "b": 0.9,
+ "a": 1
+ },
+ "enabled": true
+ }
+ }
],
"visible": true
}
diff --git a/desktop/public/scenes/ui-text-rect.esscene b/desktop/public/scenes/ui-text-rect.esscene
index d6344b1fc..b19bae8e4 100644
--- a/desktop/public/scenes/ui-text-rect.esscene
+++ b/desktop/public/scenes/ui-text-rect.esscene
@@ -8,8 +8,25 @@
"parent": null,
"children": [],
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 10 } } },
- { "type": "Camera", "data": { "projectionType": 1, "orthoSize": 300, "isActive": true, "priority": 0 } }
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 10
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 300,
+ "isActive": true,
+ "priority": 0
+ }
+ }
],
"visible": true
},
@@ -17,11 +34,28 @@
"id": 1,
"name": "Canvas",
"parent": null,
- "children": [2],
+ "children": [
+ 2
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "Canvas", "data": { "designResolution": { "x": 800, "y": 600 }, "scaleMode": 2 } },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "size": { "x": 800, "y": 600 }, "pivot": { "x": 0.5, "y": 0.5 } } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "Canvas",
+ "data": {
+ "designResolution": {
+ "x": 800,
+ "y": 600
+ },
+ "scaleMode": 2
+ }
+ },
+ {
+ "type": "UINode",
+ "data": {}
+ }
],
"visible": true
},
@@ -31,15 +65,52 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "size": { "x": 440, "y": 200 }, "pivot": { "x": 0.5, "y": 0.5 } } },
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 440.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -220.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 200.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -100.0,
+ "unit": 0
+ }
+ }
+ },
{
"type": "Text",
"data": {
"content": "Centered in its UIRect 矩形内居中并自动换行测试",
"fontFamily": "sans-serif",
"fontSize": 40,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1,
"wordWrap": true
diff --git a/desktop/public/scenes/ui-text-uinode.esscene b/desktop/public/scenes/ui-text-uinode.esscene
index 86196a834..b8661482b 100644
--- a/desktop/public/scenes/ui-text-uinode.esscene
+++ b/desktop/public/scenes/ui-text-uinode.esscene
@@ -8,8 +8,25 @@
"parent": null,
"children": [],
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 10 } } },
- { "type": "Camera", "data": { "projectionType": 1, "orthoSize": 300, "isActive": true, "priority": 0 } }
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 10
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 300,
+ "isActive": true,
+ "priority": 0
+ }
+ }
],
"visible": true
},
@@ -17,11 +34,28 @@
"id": 1,
"name": "Canvas",
"parent": null,
- "children": [2],
+ "children": [
+ 2
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "Canvas", "data": { "designResolution": { "x": 800, "y": 600 }, "scaleMode": 2 } },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "size": { "x": 800, "y": 600 }, "pivot": { "x": 0.5, "y": 0.5 } } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "Canvas",
+ "data": {
+ "designResolution": {
+ "x": 800,
+ "y": 600
+ },
+ "scaleMode": 2
+ }
+ },
+ {
+ "type": "UINode",
+ "data": {}
+ }
],
"visible": true
},
@@ -31,16 +65,57 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UINode", "data": { "position": 1, "insetLeft": { "value": 180, "unit": 0 }, "insetTop": { "value": 220, "unit": 0 }, "width": { "value": 440, "unit": 0 }, "height": { "value": 160, "unit": 0 } } },
- { "type": "UIRenderer", "data": { "visualType": 1, "color": { "r": 0.18, "g": 0.2, "b": 0.28, "a": 1 }, "enabled": true } },
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "insetLeft": {
+ "value": 180,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 220,
+ "unit": 0
+ },
+ "width": {
+ "value": 440,
+ "unit": 0
+ },
+ "height": {
+ "value": 160,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "UIRenderer",
+ "data": {
+ "visualType": 1,
+ "color": {
+ "r": 0.18,
+ "g": 0.2,
+ "b": 0.28,
+ "a": 1
+ },
+ "enabled": true
+ }
+ },
{
"type": "Text",
"data": {
"content": "UINode 文本框:自动换行 + 居中 wraps and centers inside its box",
"fontFamily": "sans-serif",
"fontSize": 34,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1,
"wordWrap": true
diff --git a/desktop/public/scenes/ui-text-zorder.esscene b/desktop/public/scenes/ui-text-zorder.esscene
index deea5f7b8..7dce375fd 100644
--- a/desktop/public/scenes/ui-text-zorder.esscene
+++ b/desktop/public/scenes/ui-text-zorder.esscene
@@ -8,8 +8,25 @@
"parent": null,
"children": [],
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 10 } } },
- { "type": "Camera", "data": { "projectionType": 1, "orthoSize": 300, "isActive": true, "priority": 0 } }
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 10
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 300,
+ "isActive": true,
+ "priority": 0
+ }
+ }
],
"visible": true
},
@@ -17,11 +34,28 @@
"id": 1,
"name": "Canvas",
"parent": null,
- "children": [2],
+ "children": [
+ 2
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "Canvas", "data": { "designResolution": { "x": 800, "y": 600 }, "scaleMode": 2 } },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "size": { "x": 800, "y": 600 }, "pivot": { "x": 0.5, "y": 0.5 } } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "Canvas",
+ "data": {
+ "designResolution": {
+ "x": 800,
+ "y": 600
+ },
+ "scaleMode": 2
+ }
+ },
+ {
+ "type": "UINode",
+ "data": {}
+ }
],
"visible": true
},
@@ -29,11 +63,57 @@
"id": 2,
"name": "Panel",
"parent": 1,
- "children": [3],
+ "children": [
+ 3
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "size": { "x": 460, "y": 150 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "UIRenderer", "data": { "visualType": 1, "color": { "r": 0.2, "g": 0.32, "b": 0.6, "a": 1 }, "enabled": true } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 460.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -230.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 150.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -75.0,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "UIRenderer",
+ "data": {
+ "visualType": 1,
+ "color": {
+ "r": 0.2,
+ "g": 0.32,
+ "b": 0.6,
+ "a": 1
+ },
+ "enabled": true
+ }
+ }
],
"visible": true
},
@@ -43,15 +123,52 @@
"parent": 2,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "size": { "x": 440, "y": 130 }, "pivot": { "x": 0.5, "y": 0.5 } } },
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 440.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -220.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 130.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -65.0,
+ "unit": 0
+ }
+ }
+ },
{
"type": "Text",
"data": {
"content": "文字在面板上 Text on panel",
"fontFamily": "sans-serif",
"fontSize": 44,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1,
"wordWrap": true
diff --git a/examples/audio-demo/assets/scenes/main.esscene b/examples/audio-demo/assets/scenes/main.esscene
index 8d2c52f5a..8a9f9fc9c 100644
--- a/examples/audio-demo/assets/scenes/main.esscene
+++ b/examples/audio-demo/assets/scenes/main.esscene
@@ -11,7 +11,11 @@
{
"type": "Transform",
"data": {
- "position": { "x": 0, "y": 0, "z": 10 }
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 10
+ }
}
},
{
@@ -30,24 +34,51 @@
"id": 1,
"name": "Canvas",
"parent": null,
- "children": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26],
+ "children": [
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26
+ ],
"components": [
- { "type": "Transform", "data": {} },
+ {
+ "type": "Transform",
+ "data": {}
+ },
{
"type": "Canvas",
"data": {
- "designResolution": { "x": 800, "y": 600 },
+ "designResolution": {
+ "x": 800,
+ "y": 600
+ },
"scaleMode": 2
}
},
{
- "type": "UIRect",
- "data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "size": { "x": 800, "y": 600 },
- "pivot": { "x": 0.5, "y": 0.5 }
- }
+ "type": "UINode",
+ "data": {}
}
],
"visible": true
@@ -58,15 +89,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 1 },
- "anchorMax": { "x": 0.5, "y": 1 },
- "offsetMin": { "x": 0, "y": -45 },
- "size": { "x": 400, "y": 45 },
- "pivot": { "x": 0.5, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 400.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -200.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 45.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 45.0,
+ "unit": 0
+ }
}
},
{
@@ -74,7 +128,12 @@
"data": {
"content": "Audio Demo",
"fontSize": 32,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -88,21 +147,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -280, "y": 80 },
- "size": { "x": 110, "y": 50 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 110.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -335.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 50.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -105.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.9, "g": 0.3, "b": 0.3, "a": 1 }
+ "color": {
+ "r": 0.9,
+ "g": 0.3,
+ "b": 0.3,
+ "a": 1
+ }
}
},
{
@@ -111,7 +198,10 @@
"state": 0
}
},
- { "type": "Interactable", "data": {} },
+ {
+ "type": "Interactable",
+ "data": {}
+ },
{
"type": "SFXTrigger",
"data": {
@@ -127,15 +217,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -280, "y": 80 },
- "size": { "x": 110, "y": 50 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 110.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -335.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 50.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -105.0,
+ "unit": 0
+ }
}
},
{
@@ -143,7 +256,12 @@
"data": {
"content": "Kick",
"fontSize": 20,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -157,21 +275,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -130, "y": 80 },
- "size": { "x": 110, "y": 50 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 110.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -185.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 50.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -105.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.3, "g": 0.7, "b": 0.9, "a": 1 }
+ "color": {
+ "r": 0.3,
+ "g": 0.7,
+ "b": 0.9,
+ "a": 1
+ }
}
},
{
@@ -180,7 +326,10 @@
"state": 0
}
},
- { "type": "Interactable", "data": {} },
+ {
+ "type": "Interactable",
+ "data": {}
+ },
{
"type": "SFXTrigger",
"data": {
@@ -196,15 +345,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -130, "y": 80 },
- "size": { "x": 110, "y": 50 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 110.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -185.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 50.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -105.0,
+ "unit": 0
+ }
}
},
{
@@ -212,7 +384,12 @@
"data": {
"content": "Snare",
"fontSize": 20,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -226,21 +403,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 20, "y": 80 },
- "size": { "x": 110, "y": 50 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 110.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -35.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 50.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -105.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.3, "g": 0.9, "b": 0.4, "a": 1 }
+ "color": {
+ "r": 0.3,
+ "g": 0.9,
+ "b": 0.4,
+ "a": 1
+ }
}
},
{
@@ -249,7 +454,10 @@
"state": 0
}
},
- { "type": "Interactable", "data": {} },
+ {
+ "type": "Interactable",
+ "data": {}
+ },
{
"type": "SFXTrigger",
"data": {
@@ -265,15 +473,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 20, "y": 80 },
- "size": { "x": 110, "y": 50 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 110.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -35.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 50.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -105.0,
+ "unit": 0
+ }
}
},
{
@@ -281,7 +512,12 @@
"data": {
"content": "Hi-Hat",
"fontSize": 20,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -295,21 +531,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 170, "y": 80 },
- "size": { "x": 110, "y": 50 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 110.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 115.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 50.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -105.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.9, "g": 0.7, "b": 0.2, "a": 1 }
+ "color": {
+ "r": 0.9,
+ "g": 0.7,
+ "b": 0.2,
+ "a": 1
+ }
}
},
{
@@ -318,7 +582,10 @@
"state": 0
}
},
- { "type": "Interactable", "data": {} },
+ {
+ "type": "Interactable",
+ "data": {}
+ },
{
"type": "SFXTrigger",
"data": {
@@ -334,15 +601,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 170, "y": 80 },
- "size": { "x": 110, "y": 50 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 110.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 115.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 50.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -105.0,
+ "unit": 0
+ }
}
},
{
@@ -350,7 +640,12 @@
"data": {
"content": "Clap",
"fontSize": 20,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -364,24 +659,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -205, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -205.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.91, "g": 0.19, "b": 0.19, "a": 1 }
+ "color": {
+ "r": 0.91,
+ "g": 0.19,
+ "b": 0.19,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -391,24 +717,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -179, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -179.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.91, "g": 0.46, "b": 0.19, "a": 1 }
+ "color": {
+ "r": 0.91,
+ "g": 0.46,
+ "b": 0.19,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -418,24 +775,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -153, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -153.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.91, "g": 0.73, "b": 0.19, "a": 1 }
+ "color": {
+ "r": 0.91,
+ "g": 0.73,
+ "b": 0.19,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -445,24 +833,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -127, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -127.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.82, "g": 0.91, "b": 0.19, "a": 1 }
+ "color": {
+ "r": 0.82,
+ "g": 0.91,
+ "b": 0.19,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -472,24 +891,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -101, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -101.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.55, "g": 0.91, "b": 0.19, "a": 1 }
+ "color": {
+ "r": 0.55,
+ "g": 0.91,
+ "b": 0.19,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -499,24 +949,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -75, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -75.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.28, "g": 0.91, "b": 0.19, "a": 1 }
+ "color": {
+ "r": 0.28,
+ "g": 0.91,
+ "b": 0.19,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -526,24 +1007,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -49, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -49.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.19, "g": 0.91, "b": 0.37, "a": 1 }
+ "color": {
+ "r": 0.19,
+ "g": 0.91,
+ "b": 0.37,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -553,24 +1065,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -23, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -23.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.19, "g": 0.91, "b": 0.64, "a": 1 }
+ "color": {
+ "r": 0.19,
+ "g": 0.91,
+ "b": 0.64,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -580,24 +1123,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 3, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 3.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.19, "g": 0.91, "b": 0.91, "a": 1 }
+ "color": {
+ "r": 0.19,
+ "g": 0.91,
+ "b": 0.91,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -607,24 +1181,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 29, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 29.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.19, "g": 0.64, "b": 0.91, "a": 1 }
+ "color": {
+ "r": 0.19,
+ "g": 0.64,
+ "b": 0.91,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -634,24 +1239,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 55, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.19, "g": 0.37, "b": 0.91, "a": 1 }
+ "color": {
+ "r": 0.19,
+ "g": 0.37,
+ "b": 0.91,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -661,24 +1297,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 81, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 81.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.28, "g": 0.19, "b": 0.91, "a": 1 }
+ "color": {
+ "r": 0.28,
+ "g": 0.19,
+ "b": 0.91,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -688,24 +1355,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 107, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 107.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.55, "g": 0.19, "b": 0.91, "a": 1 }
+ "color": {
+ "r": 0.55,
+ "g": 0.19,
+ "b": 0.91,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -715,24 +1413,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 133, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 133.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.82, "g": 0.19, "b": 0.91, "a": 1 }
+ "color": {
+ "r": 0.82,
+ "g": 0.19,
+ "b": 0.91,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -742,24 +1471,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 159, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 159.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.91, "g": 0.19, "b": 0.73, "a": 1 }
+ "color": {
+ "r": 0.91,
+ "g": 0.19,
+ "b": 0.73,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
},
@@ -769,24 +1529,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 185, "y": -200 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0, "y": 0 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 185.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 180.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.91, "g": 0.19, "b": 0.46, "a": 1 }
+ "color": {
+ "r": 0.91,
+ "g": 0.19,
+ "b": 0.46,
+ "a": 1
+ }
}
},
- { "type": "Visualizer", "data": {} }
+ {
+ "type": "Visualizer",
+ "data": {}
+ }
],
"visible": true
}
diff --git a/examples/space-shooter/assets/scenes/main.esscene b/examples/space-shooter/assets/scenes/main.esscene
index a05d169d8..ea392570d 100644
--- a/examples/space-shooter/assets/scenes/main.esscene
+++ b/examples/space-shooter/assets/scenes/main.esscene
@@ -129,25 +129,8 @@
}
},
{
- "type": "UIRect",
- "data": {
- "anchorMin": {
- "x": 0.5,
- "y": 0.5
- },
- "anchorMax": {
- "x": 0.5,
- "y": 0.5
- },
- "size": {
- "x": 600,
- "y": 1080
- },
- "pivot": {
- "x": 0.5,
- "y": 0.5
- }
- }
+ "type": "UINode",
+ "data": {}
}
],
"visible": true
@@ -163,27 +146,32 @@
"data": {}
},
{
- "type": "UIRect",
+ "type": "UINode",
"data": {
- "anchorMin": {
- "x": 0,
- "y": 1
+ "position": 1,
+ "width": {
+ "value": 200.0,
+ "unit": 0
},
- "anchorMax": {
- "x": 0,
- "y": 1
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
},
- "offsetMin": {
- "x": 20,
- "y": -40
+ "marginLeft": {
+ "value": 20.0,
+ "unit": 0
},
- "size": {
- "x": 200,
- "y": 40
+ "height": {
+ "value": 40.0,
+ "unit": 0
},
- "pivot": {
- "x": 0,
- "y": 1
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 40.0,
+ "unit": 0
}
}
},
@@ -226,27 +214,32 @@
}
},
{
- "type": "UIRect",
+ "type": "UINode",
"data": {
- "anchorMin": {
- "x": 1,
- "y": 1
+ "position": 1,
+ "width": {
+ "value": 24.0,
+ "unit": 0
},
- "anchorMax": {
- "x": 1,
- "y": 1
+ "insetLeft": {
+ "value": 100.0,
+ "unit": 1
},
- "offsetMin": {
- "x": -84,
- "y": -20
+ "marginLeft": {
+ "value": -108.0,
+ "unit": 0
},
- "size": {
- "x": 24,
- "y": 24
+ "height": {
+ "value": 24.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
},
- "pivot": {
- "x": 1,
- "y": 1
+ "marginTop": {
+ "value": 20.0,
+ "unit": 0
}
}
},
@@ -286,27 +279,32 @@
}
},
{
- "type": "UIRect",
+ "type": "UINode",
"data": {
- "anchorMin": {
- "x": 1,
- "y": 1
+ "position": 1,
+ "width": {
+ "value": 24.0,
+ "unit": 0
},
- "anchorMax": {
- "x": 1,
- "y": 1
+ "insetLeft": {
+ "value": 100.0,
+ "unit": 1
},
- "offsetMin": {
- "x": -52,
- "y": -20
+ "marginLeft": {
+ "value": -76.0,
+ "unit": 0
},
- "size": {
- "x": 24,
- "y": 24
+ "height": {
+ "value": 24.0,
+ "unit": 0
},
- "pivot": {
- "x": 1,
- "y": 1
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 20.0,
+ "unit": 0
}
}
},
@@ -346,27 +344,32 @@
}
},
{
- "type": "UIRect",
+ "type": "UINode",
"data": {
- "anchorMin": {
- "x": 1,
- "y": 1
+ "position": 1,
+ "width": {
+ "value": 24.0,
+ "unit": 0
},
- "anchorMax": {
- "x": 1,
- "y": 1
+ "insetLeft": {
+ "value": 100.0,
+ "unit": 1
},
- "offsetMin": {
- "x": -20,
- "y": -20
+ "marginLeft": {
+ "value": -44.0,
+ "unit": 0
},
- "size": {
- "x": 24,
- "y": 24
+ "height": {
+ "value": 24.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
},
- "pivot": {
- "x": 1,
- "y": 1
+ "marginTop": {
+ "value": 20.0,
+ "unit": 0
}
}
},
@@ -400,27 +403,32 @@
"data": {}
},
{
- "type": "UIRect",
+ "type": "UINode",
"data": {
- "anchorMin": {
- "x": 0.5,
- "y": 0.5
+ "position": 1,
+ "width": {
+ "value": 400.0,
+ "unit": 0
},
- "anchorMax": {
- "x": 0.5,
- "y": 0.5
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
},
- "offsetMin": {
- "x": 0,
- "y": 0
+ "marginLeft": {
+ "value": -200.0,
+ "unit": 0
},
- "size": {
- "x": 400,
- "y": 120
+ "height": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
},
- "pivot": {
- "x": 0.5,
- "y": 0.5
+ "marginTop": {
+ "value": -60.0,
+ "unit": 0
}
}
},
diff --git a/examples/ui-controls/assets/scenes/main.esscene b/examples/ui-controls/assets/scenes/main.esscene
index 8c5ebe2a8..14414fc65 100644
--- a/examples/ui-controls/assets/scenes/main.esscene
+++ b/examples/ui-controls/assets/scenes/main.esscene
@@ -11,7 +11,11 @@
{
"type": "Transform",
"data": {
- "position": { "x": 0, "y": 0, "z": 10 }
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 10
+ }
}
},
{
@@ -30,24 +34,40 @@
"id": 1,
"name": "Canvas",
"parent": null,
- "children": [2, 3, 5, 7, 9, 10, 11, 12, 13, 14, 15, 18, 21, 24],
+ "children": [
+ 2,
+ 3,
+ 5,
+ 7,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 18,
+ 21,
+ 24
+ ],
"components": [
- { "type": "Transform", "data": {} },
+ {
+ "type": "Transform",
+ "data": {}
+ },
{
"type": "Canvas",
"data": {
- "designResolution": { "x": 800, "y": 600 },
+ "designResolution": {
+ "x": 800,
+ "y": 600
+ },
"scaleMode": 2
}
},
{
- "type": "UIRect",
- "data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "size": { "x": 800, "y": 600 },
- "pivot": { "x": 0.5, "y": 0.5 }
- }
+ "type": "UINode",
+ "data": {}
}
],
"visible": true
@@ -58,15 +78,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 1 },
- "anchorMax": { "x": 0.5, "y": 1 },
- "offsetMin": { "x": 0, "y": -50 },
- "size": { "x": 400, "y": 50 },
- "pivot": { "x": 0.5, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 400.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -200.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 50.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 50.0,
+ "unit": 0
+ }
}
},
{
@@ -74,7 +117,12 @@
"data": {
"content": "UI Controls Gallery",
"fontSize": 32,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -86,23 +134,53 @@
"id": 3,
"name": "PrimaryBtn",
"parent": 1,
- "children": [4],
+ "children": [
+ 4
+ ],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -270, "y": 100 },
- "size": { "x": 140, "y": 45 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 140.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -340.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 45.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -122.5,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.2, "g": 0.6, "b": 1, "a": 1 }
+ "color": {
+ "r": 0.2,
+ "g": 0.6,
+ "b": 1,
+ "a": 1
+ }
}
},
{
@@ -110,14 +188,37 @@
"data": {
"state": 0,
"transition": {
- "normalColor": { "r": 0.2, "g": 0.6, "b": 1, "a": 1 },
- "hoveredColor": { "r": 0.2, "g": 0.6, "b": 1, "a": 0.8 },
- "pressedColor": { "r": 0.2, "g": 0.6, "b": 1, "a": 0.6 },
- "disabledColor": { "r": 0.3, "g": 0.3, "b": 0.3, "a": 1 }
+ "normalColor": {
+ "r": 0.2,
+ "g": 0.6,
+ "b": 1,
+ "a": 1
+ },
+ "hoveredColor": {
+ "r": 0.2,
+ "g": 0.6,
+ "b": 1,
+ "a": 0.8
+ },
+ "pressedColor": {
+ "r": 0.2,
+ "g": 0.6,
+ "b": 1,
+ "a": 0.6
+ },
+ "disabledColor": {
+ "r": 0.3,
+ "g": 0.3,
+ "b": 0.3,
+ "a": 1
+ }
}
}
},
- { "type": "Interactable", "data": {} }
+ {
+ "type": "Interactable",
+ "data": {}
+ }
],
"visible": true
},
@@ -127,15 +228,30 @@
"parent": 3,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0 },
- "anchorMax": { "x": 1, "y": 1 },
- "offsetMin": { "x": 0, "y": 0 },
- "size": { "x": 0, "y": 0 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetBottom": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ }
}
},
{
@@ -143,7 +259,12 @@
"data": {
"content": "Primary",
"fontSize": 20,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -155,23 +276,53 @@
"id": 5,
"name": "SuccessBtn",
"parent": 1,
- "children": [6],
+ "children": [
+ 6
+ ],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -70, "y": 100 },
- "size": { "x": 140, "y": 45 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 140.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -140.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 45.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -122.5,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.2, "g": 0.8, "b": 0.4, "a": 1 }
+ "color": {
+ "r": 0.2,
+ "g": 0.8,
+ "b": 0.4,
+ "a": 1
+ }
}
},
{
@@ -179,14 +330,37 @@
"data": {
"state": 0,
"transition": {
- "normalColor": { "r": 0.2, "g": 0.8, "b": 0.4, "a": 1 },
- "hoveredColor": { "r": 0.2, "g": 0.8, "b": 0.4, "a": 0.8 },
- "pressedColor": { "r": 0.2, "g": 0.8, "b": 0.4, "a": 0.6 },
- "disabledColor": { "r": 0.3, "g": 0.3, "b": 0.3, "a": 1 }
+ "normalColor": {
+ "r": 0.2,
+ "g": 0.8,
+ "b": 0.4,
+ "a": 1
+ },
+ "hoveredColor": {
+ "r": 0.2,
+ "g": 0.8,
+ "b": 0.4,
+ "a": 0.8
+ },
+ "pressedColor": {
+ "r": 0.2,
+ "g": 0.8,
+ "b": 0.4,
+ "a": 0.6
+ },
+ "disabledColor": {
+ "r": 0.3,
+ "g": 0.3,
+ "b": 0.3,
+ "a": 1
+ }
}
}
},
- { "type": "Interactable", "data": {} }
+ {
+ "type": "Interactable",
+ "data": {}
+ }
],
"visible": true
},
@@ -196,15 +370,30 @@
"parent": 5,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0 },
- "anchorMax": { "x": 1, "y": 1 },
- "offsetMin": { "x": 0, "y": 0 },
- "size": { "x": 0, "y": 0 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetBottom": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ }
}
},
{
@@ -212,7 +401,12 @@
"data": {
"content": "Success",
"fontSize": 20,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -224,23 +418,53 @@
"id": 7,
"name": "DangerBtn",
"parent": 1,
- "children": [8],
+ "children": [
+ 8
+ ],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 130, "y": 100 },
- "size": { "x": 140, "y": 45 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 140.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 60.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 45.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -122.5,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.9, "g": 0.3, "b": 0.3, "a": 1 }
+ "color": {
+ "r": 0.9,
+ "g": 0.3,
+ "b": 0.3,
+ "a": 1
+ }
}
},
{
@@ -248,14 +472,37 @@
"data": {
"state": 0,
"transition": {
- "normalColor": { "r": 0.9, "g": 0.3, "b": 0.3, "a": 1 },
- "hoveredColor": { "r": 0.9, "g": 0.3, "b": 0.3, "a": 0.8 },
- "pressedColor": { "r": 0.9, "g": 0.3, "b": 0.3, "a": 0.6 },
- "disabledColor": { "r": 0.3, "g": 0.3, "b": 0.3, "a": 1 }
+ "normalColor": {
+ "r": 0.9,
+ "g": 0.3,
+ "b": 0.3,
+ "a": 1
+ },
+ "hoveredColor": {
+ "r": 0.9,
+ "g": 0.3,
+ "b": 0.3,
+ "a": 0.8
+ },
+ "pressedColor": {
+ "r": 0.9,
+ "g": 0.3,
+ "b": 0.3,
+ "a": 0.6
+ },
+ "disabledColor": {
+ "r": 0.3,
+ "g": 0.3,
+ "b": 0.3,
+ "a": 1
+ }
}
}
},
- { "type": "Interactable", "data": {} }
+ {
+ "type": "Interactable",
+ "data": {}
+ }
],
"visible": true
},
@@ -265,15 +512,30 @@
"parent": 7,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0 },
- "anchorMax": { "x": 1, "y": 1 },
- "offsetMin": { "x": 0, "y": 0 },
- "size": { "x": 0, "y": 0 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetBottom": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ }
}
},
{
@@ -281,7 +543,12 @@
"data": {
"content": "Danger",
"fontSize": 20,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -295,25 +562,54 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -215, "y": 20 },
- "size": { "x": 30, "y": 30 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 30.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -230.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 30.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -35.0,
+ "unit": 0
+ }
}
},
- { "type": "Image", "data": {} },
+ {
+ "type": "Image",
+ "data": {}
+ },
{
"type": "Toggle",
"data": {
"isOn": true
}
},
- { "type": "Interactable", "data": {} }
+ {
+ "type": "Interactable",
+ "data": {}
+ }
],
"visible": true
},
@@ -323,15 +619,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -175, "y": 20 },
- "size": { "x": 100, "y": 30 },
- "pivot": { "x": 0, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 100.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -175.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 30.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -35.0,
+ "unit": 0
+ }
}
},
{
@@ -339,7 +658,12 @@
"data": {
"content": "Option 1",
"fontSize": 18,
- "color": { "r": 0.8, "g": 0.8, "b": 0.8, "a": 1 },
+ "color": {
+ "r": 0.8,
+ "g": 0.8,
+ "b": 0.8,
+ "a": 1
+ },
"align": 0,
"verticalAlign": 1
}
@@ -353,25 +677,54 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -15, "y": 20 },
- "size": { "x": 30, "y": 30 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 30.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -30.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 30.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -35.0,
+ "unit": 0
+ }
}
},
- { "type": "Image", "data": {} },
+ {
+ "type": "Image",
+ "data": {}
+ },
{
"type": "Toggle",
"data": {
"isOn": false
}
},
- { "type": "Interactable", "data": {} }
+ {
+ "type": "Interactable",
+ "data": {}
+ }
],
"visible": true
},
@@ -381,15 +734,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 25, "y": 20 },
- "size": { "x": 100, "y": 30 },
- "pivot": { "x": 0, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 100.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 25.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 30.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -35.0,
+ "unit": 0
+ }
}
},
{
@@ -397,7 +773,12 @@
"data": {
"content": "Option 2",
"fontSize": 18,
- "color": { "r": 0.8, "g": 0.8, "b": 0.8, "a": 1 },
+ "color": {
+ "r": 0.8,
+ "g": 0.8,
+ "b": 0.8,
+ "a": 1
+ },
"align": 0,
"verticalAlign": 1
}
@@ -411,25 +792,54 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 185, "y": 20 },
- "size": { "x": 30, "y": 30 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 30.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 170.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 30.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -35.0,
+ "unit": 0
+ }
}
},
- { "type": "Image", "data": {} },
+ {
+ "type": "Image",
+ "data": {}
+ },
{
"type": "Toggle",
"data": {
"isOn": false
}
},
- { "type": "Interactable", "data": {} }
+ {
+ "type": "Interactable",
+ "data": {}
+ }
],
"visible": true
},
@@ -439,15 +849,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 225, "y": 20 },
- "size": { "x": 100, "y": 30 },
- "pivot": { "x": 0, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 100.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 225.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 30.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -35.0,
+ "unit": 0
+ }
}
},
{
@@ -455,7 +888,12 @@
"data": {
"content": "Option 3",
"fontSize": 18,
- "color": { "r": 0.8, "g": 0.8, "b": 0.8, "a": 1 },
+ "color": {
+ "r": 0.8,
+ "g": 0.8,
+ "b": 0.8,
+ "a": 1
+ },
"align": 0,
"verticalAlign": 1
}
@@ -467,23 +905,54 @@
"id": 15,
"name": "Slider",
"parent": 1,
- "children": [16, 17],
+ "children": [
+ 16,
+ 17
+ ],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -200, "y": -60 },
- "size": { "x": 400, "y": 8 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 400.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -400.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 8.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 56.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.3, "g": 0.3, "b": 0.3, "a": 1 }
+ "color": {
+ "r": 0.3,
+ "g": 0.3,
+ "b": 0.3,
+ "a": 1
+ }
}
},
{
@@ -497,7 +966,10 @@
"handleEntity": 17
}
},
- { "type": "Interactable", "data": {} }
+ {
+ "type": "Interactable",
+ "data": {}
+ }
],
"visible": true
},
@@ -507,21 +979,45 @@
"parent": 15,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0.5 },
- "anchorMax": { "x": 0, "y": 0.5 },
- "offsetMin": { "x": 0, "y": 0 },
- "size": { "x": 200, "y": 8 },
- "pivot": { "x": 0, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 200.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "height": {
+ "value": 8.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -4.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.2, "g": 0.6, "b": 1, "a": 1 }
+ "color": {
+ "r": 0.2,
+ "g": 0.6,
+ "b": 1,
+ "a": 1
+ }
}
}
],
@@ -533,21 +1029,49 @@
"parent": 15,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 0, "y": 0 },
- "size": { "x": 20, "y": 20 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -10.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -10.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 }
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ }
}
}
],
@@ -557,23 +1081,53 @@
"id": 18,
"name": "ProgressBar1",
"parent": 1,
- "children": [19],
+ "children": [
+ 19
+ ],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -200, "y": -120 },
- "size": { "x": 400, "y": 20 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 400.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -400.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 110.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.2, "g": 0.2, "b": 0.2, "a": 1 }
+ "color": {
+ "r": 0.2,
+ "g": 0.2,
+ "b": 0.2,
+ "a": 1
+ }
}
},
{
@@ -600,21 +1154,45 @@
"parent": 18,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0.5 },
- "anchorMax": { "x": 0, "y": 0.5 },
- "offsetMin": { "x": 0, "y": 0 },
- "size": { "x": 120, "y": 20 },
- "pivot": { "x": 0, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -10.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.2, "g": 0.8, "b": 0.4, "a": 1 }
+ "color": {
+ "r": 0.2,
+ "g": 0.8,
+ "b": 0.4,
+ "a": 1
+ }
}
}
],
@@ -624,23 +1202,53 @@
"id": 21,
"name": "ProgressBar2",
"parent": 1,
- "children": [22],
+ "children": [
+ 22
+ ],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -200, "y": -160 },
- "size": { "x": 400, "y": 20 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 400.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -400.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 150.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.2, "g": 0.2, "b": 0.2, "a": 1 }
+ "color": {
+ "r": 0.2,
+ "g": 0.2,
+ "b": 0.2,
+ "a": 1
+ }
}
},
{
@@ -667,21 +1275,45 @@
"parent": 21,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0.5 },
- "anchorMax": { "x": 0, "y": 0.5 },
- "offsetMin": { "x": 0, "y": 0 },
- "size": { "x": 220, "y": 20 },
- "pivot": { "x": 0, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 220.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -10.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 1, "g": 0.7, "b": 0.1, "a": 1 }
+ "color": {
+ "r": 1,
+ "g": 0.7,
+ "b": 0.1,
+ "a": 1
+ }
}
}
],
@@ -691,23 +1323,53 @@
"id": 24,
"name": "ProgressBar3",
"parent": 1,
- "children": [25],
+ "children": [
+ 25
+ ],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": -200, "y": -200 },
- "size": { "x": 400, "y": 20 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 400.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -400.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 190.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.2, "g": 0.2, "b": 0.2, "a": 1 }
+ "color": {
+ "r": 0.2,
+ "g": 0.2,
+ "b": 0.2,
+ "a": 1
+ }
}
},
{
@@ -734,21 +1396,45 @@
"parent": 24,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0.5 },
- "anchorMax": { "x": 0, "y": 0.5 },
- "offsetMin": { "x": 0, "y": 0 },
- "size": { "x": 320, "y": 20 },
- "pivot": { "x": 0, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 320.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "height": {
+ "value": 20.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -10.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.9, "g": 0.3, "b": 0.3, "a": 1 }
+ "color": {
+ "r": 0.9,
+ "g": 0.3,
+ "b": 0.3,
+ "a": 1
+ }
}
}
],
diff --git a/examples/ui-interaction/assets/scenes/main.esscene b/examples/ui-interaction/assets/scenes/main.esscene
index 634636014..4a9c0306d 100644
--- a/examples/ui-interaction/assets/scenes/main.esscene
+++ b/examples/ui-interaction/assets/scenes/main.esscene
@@ -8,8 +8,25 @@
"parent": null,
"children": [],
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 10 } } },
- { "type": "Camera", "data": { "projectionType": 1, "orthoSize": 300, "isActive": true, "priority": 0 } }
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 10
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 300,
+ "isActive": true,
+ "priority": 0
+ }
+ }
],
"visible": true
},
@@ -17,11 +34,36 @@
"id": 1,
"name": "Canvas",
"parent": null,
- "children": [2, 3, 16, 4, 6, 8, 10, 12, 14],
+ "children": [
+ 2,
+ 3,
+ 16,
+ 4,
+ 6,
+ 8,
+ 10,
+ 12,
+ 14
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "Canvas", "data": { "designResolution": { "x": 800, "y": 600 }, "scaleMode": 2 } },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "size": { "x": 800, "y": 600 }, "pivot": { "x": 0.5, "y": 0.5 } } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "Canvas",
+ "data": {
+ "designResolution": {
+ "x": 800,
+ "y": 600
+ },
+ "scaleMode": 2
+ }
+ },
+ {
+ "type": "UINode",
+ "data": {}
+ }
],
"visible": true
},
@@ -31,9 +73,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 1 }, "anchorMax": { "x": 0.5, "y": 1 }, "offsetMin": { "x": 0, "y": -50 }, "size": { "x": 500, "y": 50 }, "pivot": { "x": 0.5, "y": 1 } } },
- { "type": "Text", "data": { "content": "Drag & Focus Demo", "fontSize": 28, "color": { "r": 1, "g": 1, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 500.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -250.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 50.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 50.0,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Drag & Focus Demo",
+ "fontSize": 28,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
],
"visible": true
},
@@ -43,9 +131,55 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 1 }, "anchorMax": { "x": 0.5, "y": 1 }, "offsetMin": { "x": 0, "y": -80 }, "size": { "x": 500, "y": 30 }, "pivot": { "x": 0.5, "y": 1 } } },
- { "type": "Text", "data": { "content": "Drag cards to rearrange \u00b7 Tab to cycle focus", "fontSize": 16, "color": { "r": 0.6, "g": 0.6, "b": 0.6, "a": 1 }, "align": 1, "verticalAlign": 1 } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 500.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -250.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 30.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 80.0,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Drag cards to rearrange · Tab to cycle focus",
+ "fontSize": 16,
+ "color": {
+ "r": 0.6,
+ "g": 0.6,
+ "b": 0.6,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
],
"visible": true
},
@@ -53,14 +187,63 @@
"id": 4,
"name": "Card1",
"parent": 1,
- "children": [5],
+ "children": [
+ 5
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "offsetMin": { "x": -350, "y": -40 }, "size": { "x": 100, "y": 80 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "Image", "data": { "color": { "r": 0.85, "g": 0.15, "b": 0.15, "a": 1 } } },
- { "type": "Interactable", "data": {} },
- { "type": "Draggable", "data": {} },
- { "type": "Focusable", "data": {} }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 100.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -400.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 80.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": {
+ "r": 0.85,
+ "g": 0.15,
+ "b": 0.15,
+ "a": 1
+ }
+ }
+ },
+ {
+ "type": "Interactable",
+ "data": {}
+ },
+ {
+ "type": "Draggable",
+ "data": {}
+ },
+ {
+ "type": "Focusable",
+ "data": {}
+ }
],
"visible": true
},
@@ -70,9 +253,47 @@
"parent": 4,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0, "y": 0 }, "anchorMax": { "x": 1, "y": 1 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "Text", "data": { "content": "Card 1", "fontSize": 18, "color": { "r": 1, "g": 1, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetBottom": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Card 1",
+ "fontSize": 18,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
],
"visible": true
},
@@ -80,14 +301,63 @@
"id": 6,
"name": "Card2",
"parent": 1,
- "children": [7],
+ "children": [
+ 7
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "offsetMin": { "x": -230, "y": -40 }, "size": { "x": 100, "y": 80 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "Image", "data": { "color": { "r": 0.85, "g": 0.85, "b": 0.15, "a": 1 } } },
- { "type": "Interactable", "data": {} },
- { "type": "Draggable", "data": {} },
- { "type": "Focusable", "data": {} }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 100.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -280.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 80.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": {
+ "r": 0.85,
+ "g": 0.85,
+ "b": 0.15,
+ "a": 1
+ }
+ }
+ },
+ {
+ "type": "Interactable",
+ "data": {}
+ },
+ {
+ "type": "Draggable",
+ "data": {}
+ },
+ {
+ "type": "Focusable",
+ "data": {}
+ }
],
"visible": true
},
@@ -97,9 +367,47 @@
"parent": 6,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0, "y": 0 }, "anchorMax": { "x": 1, "y": 1 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "Text", "data": { "content": "Card 2", "fontSize": 18, "color": { "r": 1, "g": 1, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetBottom": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Card 2",
+ "fontSize": 18,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
],
"visible": true
},
@@ -107,14 +415,63 @@
"id": 8,
"name": "Card3",
"parent": 1,
- "children": [9],
+ "children": [
+ 9
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "offsetMin": { "x": -110, "y": -40 }, "size": { "x": 100, "y": 80 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "Image", "data": { "color": { "r": 0.15, "g": 0.85, "b": 0.15, "a": 1 } } },
- { "type": "Interactable", "data": {} },
- { "type": "Draggable", "data": {} },
- { "type": "Focusable", "data": {} }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 100.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -160.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 80.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": {
+ "r": 0.15,
+ "g": 0.85,
+ "b": 0.15,
+ "a": 1
+ }
+ }
+ },
+ {
+ "type": "Interactable",
+ "data": {}
+ },
+ {
+ "type": "Draggable",
+ "data": {}
+ },
+ {
+ "type": "Focusable",
+ "data": {}
+ }
],
"visible": true
},
@@ -124,9 +481,47 @@
"parent": 8,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0, "y": 0 }, "anchorMax": { "x": 1, "y": 1 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "Text", "data": { "content": "Card 3", "fontSize": 18, "color": { "r": 1, "g": 1, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetBottom": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Card 3",
+ "fontSize": 18,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
],
"visible": true
},
@@ -134,14 +529,63 @@
"id": 10,
"name": "Card4",
"parent": 1,
- "children": [11],
+ "children": [
+ 11
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "offsetMin": { "x": 10, "y": -40 }, "size": { "x": 100, "y": 80 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "Image", "data": { "color": { "r": 0.15, "g": 0.85, "b": 0.85, "a": 1 } } },
- { "type": "Interactable", "data": {} },
- { "type": "Draggable", "data": {} },
- { "type": "Focusable", "data": {} }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 100.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -40.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 80.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": {
+ "r": 0.15,
+ "g": 0.85,
+ "b": 0.85,
+ "a": 1
+ }
+ }
+ },
+ {
+ "type": "Interactable",
+ "data": {}
+ },
+ {
+ "type": "Draggable",
+ "data": {}
+ },
+ {
+ "type": "Focusable",
+ "data": {}
+ }
],
"visible": true
},
@@ -151,9 +595,47 @@
"parent": 10,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0, "y": 0 }, "anchorMax": { "x": 1, "y": 1 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "Text", "data": { "content": "Card 4", "fontSize": 18, "color": { "r": 1, "g": 1, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetBottom": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Card 4",
+ "fontSize": 18,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
],
"visible": true
},
@@ -161,14 +643,63 @@
"id": 12,
"name": "Card5",
"parent": 1,
- "children": [13],
+ "children": [
+ 13
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "offsetMin": { "x": 130, "y": -40 }, "size": { "x": 100, "y": 80 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "Image", "data": { "color": { "r": 0.15, "g": 0.15, "b": 0.85, "a": 1 } } },
- { "type": "Interactable", "data": {} },
- { "type": "Draggable", "data": {} },
- { "type": "Focusable", "data": {} }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 100.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 80.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 80.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": {
+ "r": 0.15,
+ "g": 0.15,
+ "b": 0.85,
+ "a": 1
+ }
+ }
+ },
+ {
+ "type": "Interactable",
+ "data": {}
+ },
+ {
+ "type": "Draggable",
+ "data": {}
+ },
+ {
+ "type": "Focusable",
+ "data": {}
+ }
],
"visible": true
},
@@ -178,9 +709,47 @@
"parent": 12,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0, "y": 0 }, "anchorMax": { "x": 1, "y": 1 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "Text", "data": { "content": "Card 5", "fontSize": 18, "color": { "r": 1, "g": 1, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetBottom": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Card 5",
+ "fontSize": 18,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
],
"visible": true
},
@@ -188,14 +757,63 @@
"id": 14,
"name": "Card6",
"parent": 1,
- "children": [15],
+ "children": [
+ 15
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0.5 }, "anchorMax": { "x": 0.5, "y": 0.5 }, "offsetMin": { "x": 250, "y": -40 }, "size": { "x": 100, "y": 80 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "Image", "data": { "color": { "r": 0.85, "g": 0.15, "b": 0.85, "a": 1 } } },
- { "type": "Interactable", "data": {} },
- { "type": "Draggable", "data": {} },
- { "type": "Focusable", "data": {} }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 100.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 200.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 80.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": {
+ "r": 0.85,
+ "g": 0.15,
+ "b": 0.85,
+ "a": 1
+ }
+ }
+ },
+ {
+ "type": "Interactable",
+ "data": {}
+ },
+ {
+ "type": "Draggable",
+ "data": {}
+ },
+ {
+ "type": "Focusable",
+ "data": {}
+ }
],
"visible": true
},
@@ -205,9 +823,47 @@
"parent": 14,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0, "y": 0 }, "anchorMax": { "x": 1, "y": 1 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "Text", "data": { "content": "Card 6", "fontSize": 18, "color": { "r": 1, "g": 1, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetBottom": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Card 6",
+ "fontSize": 18,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
],
"visible": true
},
@@ -215,11 +871,55 @@
"id": 16,
"name": "DropZone",
"parent": 1,
- "children": [17],
+ "children": [
+ 17
+ ],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0.5, "y": 0 }, "anchorMax": { "x": 0.5, "y": 0 }, "offsetMin": { "x": 0, "y": 40 }, "size": { "x": 500, "y": 120 }, "pivot": { "x": 0.5, "y": 0 } } },
- { "type": "Image", "data": { "color": { "r": 0.15, "g": 0.15, "b": 0.2, "a": 0.5 } } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 500.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -250.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 100.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -160.0,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": {
+ "r": 0.15,
+ "g": 0.15,
+ "b": 0.2,
+ "a": 0.5
+ }
+ }
+ }
],
"visible": true
},
@@ -229,9 +929,47 @@
"parent": 16,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
- { "type": "UIRect", "data": { "anchorMin": { "x": 0, "y": 0 }, "anchorMax": { "x": 1, "y": 1 }, "pivot": { "x": 0.5, "y": 0.5 } } },
- { "type": "Text", "data": { "content": "Drop Zone", "fontSize": 20, "color": { "r": 0.4, "g": 0.4, "b": 0.4, "a": 1 }, "align": 1, "verticalAlign": 1 } }
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetBottom": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Drop Zone",
+ "fontSize": 20,
+ "color": {
+ "r": 0.4,
+ "g": 0.4,
+ "b": 0.4,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
],
"visible": true
}
diff --git a/examples/ui-layout/assets/scenes/main.esscene b/examples/ui-layout/assets/scenes/main.esscene
index 756c1337d..080dc88b6 100644
--- a/examples/ui-layout/assets/scenes/main.esscene
+++ b/examples/ui-layout/assets/scenes/main.esscene
@@ -11,7 +11,11 @@
{
"type": "Transform",
"data": {
- "position": { "x": 0, "y": 0, "z": 10 }
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 10
+ }
}
},
{
@@ -30,24 +34,49 @@
"id": 1,
"name": "Canvas",
"parent": null,
- "children": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24],
+ "children": [
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24
+ ],
"components": [
- { "type": "Transform", "data": {} },
+ {
+ "type": "Transform",
+ "data": {}
+ },
{
"type": "Canvas",
"data": {
- "designResolution": { "x": 800, "y": 600 },
+ "designResolution": {
+ "x": 800,
+ "y": 600
+ },
"scaleMode": 2
}
},
{
- "type": "UIRect",
- "data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "size": { "x": 800, "y": 600 },
- "pivot": { "x": 0.5, "y": 0.5 }
- }
+ "type": "UINode",
+ "data": {}
}
],
"visible": true
@@ -58,15 +87,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 1 },
- "anchorMax": { "x": 0.5, "y": 1 },
- "offsetMin": { "x": 0, "y": -40 },
- "size": { "x": 400, "y": 40 },
- "pivot": { "x": 0.5, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 400.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -200.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 40.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 40.0,
+ "unit": 0
+ }
}
},
{
@@ -74,7 +126,12 @@
"data": {
"content": "UIRect Anchor Layout",
"fontSize": 28,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -88,21 +145,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 10, "y": -10 },
- "size": { "x": 180, "y": 120 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 180.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 10.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 10.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.2, "g": 0.4, "b": 0.7, "a": 0.8 }
+ "color": {
+ "r": 0.2,
+ "g": 0.4,
+ "b": 0.7,
+ "a": 0.8
+ }
}
}
],
@@ -114,15 +199,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 10, "y": -10 },
- "size": { "x": 180, "y": 120 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 180.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 10.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 10.0,
+ "unit": 0
+ }
}
},
{
@@ -130,7 +238,12 @@
"data": {
"content": "Top-Left",
"fontSize": 16,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -144,21 +257,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 1, "y": 1 },
- "anchorMax": { "x": 1, "y": 1 },
- "offsetMin": { "x": -10, "y": -10 },
- "size": { "x": 180, "y": 120 },
- "pivot": { "x": 1, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 180.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 100.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -190.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 10.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.7, "g": 0.2, "b": 0.4, "a": 0.8 }
+ "color": {
+ "r": 0.7,
+ "g": 0.2,
+ "b": 0.4,
+ "a": 0.8
+ }
}
}
],
@@ -170,15 +311,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 1, "y": 1 },
- "anchorMax": { "x": 1, "y": 1 },
- "offsetMin": { "x": -10, "y": -10 },
- "size": { "x": 180, "y": 120 },
- "pivot": { "x": 1, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 180.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 100.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -190.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 10.0,
+ "unit": 0
+ }
}
},
{
@@ -186,7 +350,12 @@
"data": {
"content": "Top-Right",
"fontSize": 16,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -200,21 +369,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0 },
- "anchorMax": { "x": 1, "y": 0 },
- "offsetMin": { "x": 10, "y": 10 },
- "size": { "x": 780, "y": 80 },
- "pivot": { "x": 0.5, "y": 0 }
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 10.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 80.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 100.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -90.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.2, "g": 0.6, "b": 0.3, "a": 0.8 }
+ "color": {
+ "r": 0.2,
+ "g": 0.6,
+ "b": 0.3,
+ "a": 0.8
+ }
}
}
],
@@ -226,15 +423,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0 },
- "anchorMax": { "x": 1, "y": 0 },
- "offsetMin": { "x": 10, "y": 10 },
- "size": { "x": 780, "y": 80 },
- "pivot": { "x": 0.5, "y": 0 }
+ "position": 1,
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "insetRight": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 10.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 80.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 100.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -90.0,
+ "unit": 0
+ }
}
},
{
@@ -242,7 +462,12 @@
"data": {
"content": "Bottom Stretch",
"fontSize": 16,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -256,21 +481,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 0, "y": 0 },
- "size": { "x": 200, "y": 150 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 200.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -100.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 150.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -75.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.6, "g": 0.4, "b": 0.2, "a": 0.8 }
+ "color": {
+ "r": 0.6,
+ "g": 0.4,
+ "b": 0.2,
+ "a": 0.8
+ }
}
}
],
@@ -282,15 +535,38 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0.5, "y": 0.5 },
- "anchorMax": { "x": 0.5, "y": 0.5 },
- "offsetMin": { "x": 0, "y": 0 },
- "size": { "x": 200, "y": 150 },
- "pivot": { "x": 0.5, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 200.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": -100.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 150.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 50.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": -75.0,
+ "unit": 0
+ }
}
},
{
@@ -298,7 +574,12 @@
"data": {
"content": "Center",
"fontSize": 16,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -312,21 +593,45 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0.15 },
- "anchorMax": { "x": 0, "y": 0.85 },
- "offsetMin": { "x": 200, "y": 0 },
- "size": { "x": 120, "y": 300 },
- "pivot": { "x": 0, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 200.0,
+ "unit": 0
+ },
+ "insetBottom": {
+ "value": 15.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 15.0,
+ "unit": 1
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.5, "g": 0.2, "b": 0.6, "a": 0.8 }
+ "color": {
+ "r": 0.5,
+ "g": 0.2,
+ "b": 0.6,
+ "a": 0.8
+ }
}
}
],
@@ -338,15 +643,34 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 0.15 },
- "anchorMax": { "x": 0, "y": 0.85 },
- "offsetMin": { "x": 200, "y": 0 },
- "size": { "x": 120, "y": 300 },
- "pivot": { "x": 0, "y": 0.5 }
+ "position": 1,
+ "width": {
+ "value": 120.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 200.0,
+ "unit": 0
+ },
+ "insetBottom": {
+ "value": 15.0,
+ "unit": 1
+ },
+ "insetTop": {
+ "value": 15.0,
+ "unit": 1
+ }
}
},
{
@@ -354,7 +678,12 @@
"data": {
"content": "Left Stretch",
"fontSize": 16,
- "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
"align": 1,
"verticalAlign": 1
}
@@ -368,21 +697,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 430, "y": -195 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 430.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 195.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.85, "g": 0.15, "b": 0.15, "a": 0.9 }
+ "color": {
+ "r": 0.85,
+ "g": 0.15,
+ "b": 0.15,
+ "a": 0.9
+ }
}
}
],
@@ -394,21 +751,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 493, "y": -195 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 493.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 195.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.85, "g": 0.5, "b": 0.15, "a": 0.9 }
+ "color": {
+ "r": 0.85,
+ "g": 0.5,
+ "b": 0.15,
+ "a": 0.9
+ }
}
}
],
@@ -420,21 +805,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 556, "y": -195 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 556.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 195.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.85, "g": 0.85, "b": 0.15, "a": 0.9 }
+ "color": {
+ "r": 0.85,
+ "g": 0.85,
+ "b": 0.15,
+ "a": 0.9
+ }
}
}
],
@@ -446,21 +859,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 619, "y": -195 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 619.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 195.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.5, "g": 0.85, "b": 0.15, "a": 0.9 }
+ "color": {
+ "r": 0.5,
+ "g": 0.85,
+ "b": 0.15,
+ "a": 0.9
+ }
}
}
],
@@ -472,21 +913,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 430, "y": -258 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 430.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 258.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.15, "g": 0.85, "b": 0.15, "a": 0.9 }
+ "color": {
+ "r": 0.15,
+ "g": 0.85,
+ "b": 0.15,
+ "a": 0.9
+ }
}
}
],
@@ -498,21 +967,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 493, "y": -258 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 493.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 258.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.15, "g": 0.85, "b": 0.5, "a": 0.9 }
+ "color": {
+ "r": 0.15,
+ "g": 0.85,
+ "b": 0.5,
+ "a": 0.9
+ }
}
}
],
@@ -524,21 +1021,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 556, "y": -258 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 556.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 258.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.15, "g": 0.85, "b": 0.85, "a": 0.9 }
+ "color": {
+ "r": 0.15,
+ "g": 0.85,
+ "b": 0.85,
+ "a": 0.9
+ }
}
}
],
@@ -550,21 +1075,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 619, "y": -258 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 619.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 258.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.15, "g": 0.5, "b": 0.85, "a": 0.9 }
+ "color": {
+ "r": 0.15,
+ "g": 0.5,
+ "b": 0.85,
+ "a": 0.9
+ }
}
}
],
@@ -576,21 +1129,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 430, "y": -321 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 430.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 321.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.15, "g": 0.15, "b": 0.85, "a": 0.9 }
+ "color": {
+ "r": 0.15,
+ "g": 0.15,
+ "b": 0.85,
+ "a": 0.9
+ }
}
}
],
@@ -602,21 +1183,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 493, "y": -321 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 493.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 321.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.5, "g": 0.15, "b": 0.85, "a": 0.9 }
+ "color": {
+ "r": 0.5,
+ "g": 0.15,
+ "b": 0.85,
+ "a": 0.9
+ }
}
}
],
@@ -628,21 +1237,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 556, "y": -321 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 556.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 321.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.85, "g": 0.15, "b": 0.85, "a": 0.9 }
+ "color": {
+ "r": 0.85,
+ "g": 0.15,
+ "b": 0.85,
+ "a": 0.9
+ }
}
}
],
@@ -654,21 +1291,49 @@
"parent": 1,
"children": [],
"components": [
- { "type": "Transform", "data": {} },
{
- "type": "UIRect",
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
"data": {
- "anchorMin": { "x": 0, "y": 1 },
- "anchorMax": { "x": 0, "y": 1 },
- "offsetMin": { "x": 619, "y": -321 },
- "size": { "x": 55, "y": 55 },
- "pivot": { "x": 0, "y": 1 }
+ "position": 1,
+ "width": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 619.0,
+ "unit": 0
+ },
+ "height": {
+ "value": 55.0,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0.0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 321.0,
+ "unit": 0
+ }
}
},
{
"type": "Image",
"data": {
- "color": { "r": 0.85, "g": 0.15, "b": 0.5, "a": 0.9 }
+ "color": {
+ "r": 0.85,
+ "g": 0.15,
+ "b": 0.5,
+ "a": 0.9
+ }
}
}
],
diff --git a/sdk/src/animation/Tween.ts b/sdk/src/animation/Tween.ts
index b31080e9b..b5836afd1 100644
--- a/sdk/src/animation/Tween.ts
+++ b/sdk/src/animation/Tween.ts
@@ -47,7 +47,7 @@ export { ValueTweenHandle } from './ValueTween';
* TweenSystem.cpp. That's a larger cross-layer change tracked
* separately; for now TweenTarget is the stable subset.
*
- * If you need to tween a field not in this list (e.g. UIRect.anchorMin.x),
+ * If you need to tween a field not in this list (e.g. UINode.insetLeft.value),
* use `tween.value(...)` with a callback that writes the field yourself,
* or drive it via Timeline.
*/
diff --git a/sdk/src/component.generated.ts b/sdk/src/component.generated.ts
index 8461511db..2a9693a98 100644
--- a/sdk/src/component.generated.ts
+++ b/sdk/src/component.generated.ts
@@ -12,7 +12,7 @@ import type { AssetFieldType } from './scene';
* getAbiLayoutHash(); BuiltinBridge.connect() compares them and refuses to
* run on mismatch, because mismatched offsets read the wrong heap bytes.
*/
-export const ABI_LAYOUT_HASH = 'dba3504ff7b44cfd';
+export const ABI_LAYOUT_HASH = 'b20732a9b17a5058';
export interface AssetFieldMeta {
field: string;
@@ -482,20 +482,6 @@ export const COMPONENT_META: Record<string, ComponentMetaEntry> = {
colorFields: [],
animatableFields: [],
},
- UIRect: {
- defaults: {
- anchorMin: { x: 0.5, y: 0.5 },
- anchorMax: { x: 0.5, y: 0.5 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: 100, y: 100 },
- pivot: { x: 0.5, y: 0.5 },
- },
- assetFields: [],
- entityFields: [],
- colorFields: [],
- animatableFields: ['anchorMin.x', 'anchorMin.y', 'anchorMax.x', 'anchorMax.y', 'offsetMin.x', 'offsetMin.y', 'offsetMax.x', 'offsetMax.y', 'pivot.x', 'pivot.y'],
- },
UIRenderer: {
defaults: {
visualType: 0,
diff --git a/sdk/src/core-ui.ts b/sdk/src/core-ui.ts
index a88395624..dfdb79eae 100644
--- a/sdk/src/core-ui.ts
+++ b/sdk/src/core-ui.ts
@@ -2,13 +2,13 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
/**
* @file core-ui.ts
- * @brief UI layer surface (text, rect, renderer, interactables, layout).
+ * @brief UI layer surface (text, UINode box, renderer, interactables, layout).
*
- * Most application code reaches for `Text` / `UIRect` / `Interactable`
- * directly. The `compute*` / `withChildEntity` / `setEntityColor`-style
- * helpers are engine-internal glue re-exported for now so that the
- * UILayout / UIInteraction plugins that ship in the SDK can consume
- * them; they are not intended to be part of the stable public API.
+ * Most application code reaches for `Text` / `UINode` / `Interactable`
+ * directly. The `withChildEntity` / `setEntityColor`-style helpers are
+ * engine-internal glue re-exported for now so that the UILayout /
+ * UIInteraction plugins that ship in the SDK can consume them; they are
+ * not intended to be part of the stable public API.
*
* Re-exported wholesale by `core.ts`.
*/
@@ -18,7 +18,6 @@ export {
TextAlign,
TextVerticalAlign,
TextOverflow,
- UIRect,
UIRenderer,
UIVisualType,
UILayoutGeneration,
@@ -49,17 +48,7 @@ export {
UIEventQueue,
makeInteractable,
UICameraInfo,
- /** @internal layout-compute helper; used by UILayoutPlugin, unstable */
- computeUIRectLayout,
- /** @internal layout-compute helper; used by UILayoutPlugin, unstable */
- computeFillAnchors,
- /** @internal layout-compute helper; used by UILayoutPlugin, unstable */
- computeHandleAnchors,
- /** @internal layout-compute helper; used by UILayoutPlugin, unstable */
- computeFillSize,
- /** @internal layout-compute helper; used by UILayoutPlugin, unstable */
- applyDirectionalFill,
- /** @internal layout-compute helper; used by UILayoutPlugin, unstable */
+ /** @internal fill-sprite sizing helper used by widget composition, unstable */
syncFillSpriteSize,
TextInput,
Image,
@@ -74,7 +63,6 @@ export {
FocusManagerState,
SafeArea,
type TextData,
- type UIRectData,
type UIMaskData,
type MaskMode,
type TextRenderResult,
@@ -86,8 +74,6 @@ export {
type UIEventHandler,
type Unsubscribe,
type UICameraData,
- type LayoutRect,
- type LayoutResult,
type TextInputData,
type UIRendererData,
type UILayoutGenerationData,
diff --git a/sdk/src/ecs/ptrAccessors.generated.ts b/sdk/src/ecs/ptrAccessors.generated.ts
index ebaa3f699..fd9fc6cdd 100644
--- a/sdk/src/ecs/ptrAccessors.generated.ts
+++ b/sdk/src/ecs/ptrAccessors.generated.ts
@@ -1173,50 +1173,6 @@ export function createUINodeData(): UINodePtrData {
};
}
-export interface UIRectPtrData {
- anchorMin: Vec2;
- anchorMax: Vec2;
- offsetMin: Vec2;
- offsetMax: Vec2;
- size: Vec2;
- pivot: Vec2;
-}
-
-export function fillUIRect(
- f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
- ptr: number, out: UIRectPtrData,
-): void {
- const anchorMin_ = out.anchorMin; anchorMin_.x = f32[ptr >> 2]; anchorMin_.y = f32[(ptr >> 2) + 1];
- const anchorMax_ = out.anchorMax; anchorMax_.x = f32[(ptr + 8) >> 2]; anchorMax_.y = f32[((ptr + 8) >> 2) + 1];
- const offsetMin_ = out.offsetMin; offsetMin_.x = f32[(ptr + 16) >> 2]; offsetMin_.y = f32[((ptr + 16) >> 2) + 1];
- const offsetMax_ = out.offsetMax; offsetMax_.x = f32[(ptr + 24) >> 2]; offsetMax_.y = f32[((ptr + 24) >> 2) + 1];
- const size_ = out.size; size_.x = f32[(ptr + 32) >> 2]; size_.y = f32[((ptr + 32) >> 2) + 1];
- const pivot_ = out.pivot; pivot_.x = f32[(ptr + 40) >> 2]; pivot_.y = f32[((ptr + 40) >> 2) + 1];
-}
-
-export function writeUIRect(
- f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
- ptr: number, data: UIRectPtrData,
-): void {
- f32[ptr >> 2] = data.anchorMin.x; f32[(ptr >> 2) + 1] = data.anchorMin.y;
- f32[(ptr + 8) >> 2] = data.anchorMax.x; f32[((ptr + 8) >> 2) + 1] = data.anchorMax.y;
- f32[(ptr + 16) >> 2] = data.offsetMin.x; f32[((ptr + 16) >> 2) + 1] = data.offsetMin.y;
- f32[(ptr + 24) >> 2] = data.offsetMax.x; f32[((ptr + 24) >> 2) + 1] = data.offsetMax.y;
- f32[(ptr + 32) >> 2] = data.size.x; f32[((ptr + 32) >> 2) + 1] = data.size.y;
- f32[(ptr + 40) >> 2] = data.pivot.x; f32[((ptr + 40) >> 2) + 1] = data.pivot.y;
-}
-
-export function createUIRectData(): UIRectPtrData {
- return {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 0, y: 0 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 },
- pivot: { x: 0, y: 0 },
- };
-}
-
export interface UIRendererPtrData {
visualType: number;
texture: number;
@@ -1325,7 +1281,6 @@ export const PTR_ACCESSORS: Record<string, PtrAccessor<any>> = {
UIInteraction: { fill: fillUIInteraction, write: writeUIInteraction, create: createUIInteractionData },
UIMask: { fill: fillUIMask, write: writeUIMask, create: createUIMaskData },
UINode: { fill: fillUINode, write: writeUINode, create: createUINodeData },
- UIRect: { fill: fillUIRect, write: writeUIRect, create: createUIRectData },
UIRenderer: { fill: fillUIRenderer, write: writeUIRenderer, create: createUIRendererData },
Velocity: { fill: fillVelocity, write: writeVelocity, create: createVelocityData },
};
diff --git a/sdk/src/ptrLayouts.generated.ts b/sdk/src/ptrLayouts.generated.ts
index c449b405e..6aa3a5495 100644
--- a/sdk/src/ptrLayouts.generated.ts
+++ b/sdk/src/ptrLayouts.generated.ts
@@ -309,17 +309,6 @@ export const PTR_LAYOUTS: Record<string, PtrLayout> = {
{ name: 'alignSelf', type: 'u8', offset: 68 },
],
},
- UIRect: {
- ptrFn: 'getUIRectPtr',
- fields: [
- { name: 'anchorMin', type: 'vec2', offset: 0 },
- { name: 'anchorMax', type: 'vec2', offset: 8 },
- { name: 'offsetMin', type: 'vec2', offset: 16 },
- { name: 'offsetMax', type: 'vec2', offset: 24 },
- { name: 'size', type: 'vec2', offset: 32 },
- { name: 'pivot', type: 'vec2', offset: 40 },
- ],
- },
UIRenderer: {
ptrFn: 'getUIRendererPtr',
fields: [
diff --git a/sdk/src/scene.ts b/sdk/src/scene.ts
index 4f8abd63d..83a1ab7e5 100644
--- a/sdk/src/scene.ts
+++ b/sdk/src/scene.ts
@@ -328,7 +328,6 @@ export function migrateSceneData(raw: SceneData): SceneMigrationResult {
// loader expands them first, so any seen here belong to the sync path
// and are left untouched (spawnAndLoadEntities warns + skips them).
if (isPrefabEntry(entity)) continue;
- if (migrateEntityToUIRenderer(entity)) migrated = true;
for (const comp of entity.components) {
if (normalizeLegacyComponent(comp)) migrated = true;
}
@@ -338,33 +337,6 @@ export function migrateSceneData(raw: SceneData): SceneMigrationResult {
return { data, migrated, fromVersion, toVersion: SCENE_FORMAT_VERSION };
}
-/** Legacy UIRect+Sprite (no UIRenderer) → UIRenderer. Returns true if changed. */
-function migrateEntityToUIRenderer(entityData: SceneEntityData): boolean {
- const hasUIRect = entityData.components.some(c => c.type === 'UIRect');
- const spriteIdx = entityData.components.findIndex(c => c.type === 'Sprite');
- const hasUIRenderer = entityData.components.some(c => c.type === 'UIRenderer');
-
- if (!hasUIRect || spriteIdx === -1 || hasUIRenderer) return false;
-
- const sprite = entityData.components[spriteIdx].data;
- const tex = sprite.texture as number | undefined;
- entityData.components.push({
- type: 'UIRenderer',
- data: {
- visualType: tex ? 2 : 1,
- texture: tex ?? 0,
- color: sprite.color ?? { r: 1, g: 1, b: 1, a: 1 },
- uvOffset: sprite.uvOffset ?? { x: 0, y: 0 },
- uvScale: sprite.uvScale ?? { x: 1, y: 1 },
- sliceBorder: sprite.sliceBorder ?? { x: 0, y: 0, z: 0, w: 0 },
- material: sprite.material ?? 0,
- enabled: sprite.enabled ?? true,
- },
- });
- entityData.components.splice(spriteIdx, 1);
- return true;
-}
-
/** Normalize legacy component spellings in place. Returns true if changed. */
function normalizeLegacyComponent(compData: SceneComponentData): boolean {
let changed = false;
@@ -372,15 +344,6 @@ function normalizeLegacyComponent(compData: SceneComponentData): boolean {
compData.type = 'Transform';
changed = true;
}
- if (compData.type === 'UIRect') {
- const rectData = compData.data as Record<string, unknown>;
- if (rectData.anchor && !rectData.anchorMin) {
- rectData.anchorMin = { ...(rectData.anchor as Record<string, unknown>) };
- rectData.anchorMax = { ...(rectData.anchor as Record<string, unknown>) };
- delete rectData.anchor;
- changed = true;
- }
- }
if (compData.type === 'UIMask') {
const maskData = compData.data as Record<string, unknown>;
if (maskData.mode === 'scissor') { maskData.mode = 0; changed = true; }
diff --git a/sdk/src/timeline/TimelineDrive.ts b/sdk/src/timeline/TimelineDrive.ts
index e33e8d8b0..b32bf1538 100644
--- a/sdk/src/timeline/TimelineDrive.ts
+++ b/sdk/src/timeline/TimelineDrive.ts
@@ -111,7 +111,7 @@ export interface AdvanceContext {
audio?: AudioAPI | null;
/** Skip-channel filter (editor mute); forwarded to the sampler. */
sampleOpts?: SampleOptions;
- /** Side-effect hook after a property field is applied (e.g. UIRect anim flags). */
+ /** Side-effect hook after a property field is applied (e.g. UINode anim flags). */
onPropertyApplied?: (entity: Entity, asset: TimelineAsset) => void;
}
diff --git a/sdk/src/ui/core/ui-rect.ts b/sdk/src/ui/core/ui-rect.ts
deleted file mode 100644
index f291c51fa..000000000
--- a/sdk/src/ui/core/ui-rect.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: LicenseRef-PolyForm-Noncommercial-1.0.0
-// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { defineBuiltin } from '../../component';
-import type { Vec2 } from '../../types';
-
-export interface UIRectData {
- anchorMin: Vec2;
- anchorMax: Vec2;
- offsetMin: Vec2;
- offsetMax: Vec2;
- size: Vec2;
- pivot: Vec2;
-}
-
-export const UIRect = defineBuiltin<UIRectData>('UIRect', {
- anchorMin: { x: 0.5, y: 0.5 },
- anchorMax: { x: 0.5, y: 0.5 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: 100, y: 100 },
- pivot: { x: 0.5, y: 0.5 },
-});
diff --git a/sdk/src/ui/index.ts b/sdk/src/ui/index.ts
index e06cfb39b..cacd5a78e 100644
--- a/sdk/src/ui/index.ts
+++ b/sdk/src/ui/index.ts
@@ -14,10 +14,6 @@ export {
// Shared Helpers
export {
initUIHelpers,
- computeFillAnchors,
- computeHandleAnchors,
- computeFillSize,
- applyDirectionalFill,
applyColorTransition,
wrapText,
nextPowerOf2,
@@ -68,7 +64,6 @@ export {
export { DimensionUnit, type Dimension, px, percent, auto, isAuto } from './core/dimension';
export { UINode, UIPositionType, type UINodeData } from './core/ui-node';
-export { UIRect, type UIRectData } from './core/ui-rect';
export {
UIRenderer,
@@ -200,12 +195,12 @@ export {
export {
identityTransform,
- buildUIRect,
+ buildUINode,
buildUIRenderer,
buildText,
spawnUIEntity,
setUIVisible,
- type UIRectInit,
+ type UINodeInit,
type UIRendererInit,
type TextInit,
type UIEntityInit,
@@ -281,12 +276,6 @@ export {
type UICameraData,
} from './UICameraInfo';
-export {
- computeUIRectLayout,
- type LayoutRect,
- type LayoutResult,
-} from './uiHelpers';
-
export {
UILayoutGeneration,
type UILayoutGenerationData,
diff --git a/sdk/src/ui/input/drag.ts b/sdk/src/ui/input/drag.ts
index 7842542b6..a740ab604 100644
--- a/sdk/src/ui/input/drag.ts
+++ b/sdk/src/ui/input/drag.ts
@@ -3,8 +3,6 @@
import type { App, Plugin } from '../../app';
import { registerComponent, Transform, Parent, Sprite } from '../../component';
import type { TransformData, ParentData, SpriteData } from '../../component';
-import { UIRect } from '../core/ui-rect';
-import type { UIRectData } from '../core/ui-rect';
import { UINode } from '../core/ui-node';
import type { UINodeData } from '../core/ui-node';
import { px } from '../core/dimension';
@@ -209,15 +207,6 @@ export class DragPlugin implements Plugin {
node.insetLeft = px(baseL + localDelta.x);
node.insetTop = px(baseT - localDelta.y); // inset top is y-down
world.insert(activeEntity, UINode, node);
- } else if (world.has(activeEntity, UIRect)) {
- const rect = world.get(activeEntity, UIRect) as UIRectData;
- const localDelta = worldToLocalDelta(
- world, activeEntity,
- dragState.deltaWorld.x, dragState.deltaWorld.y
- );
- rect.offsetMin.x += localDelta.x;
- rect.offsetMin.y += localDelta.y;
- world.insert(activeEntity, UIRect, rect);
} else if (world.has(activeEntity, Transform)) {
const localDelta = worldToLocalDelta(
world, activeEntity,
diff --git a/sdk/src/ui/layout/layout.ts b/sdk/src/ui/layout/layout.ts
index 2c3e7a2a5..dac61da6d 100644
--- a/sdk/src/ui/layout/layout.ts
+++ b/sdk/src/ui/layout/layout.ts
@@ -18,7 +18,6 @@ import { registerComponent } from '../../component';
import { defineSystem, Schedule } from '../../system';
import { SystemLabel } from '../../systemLabels';
import { Res } from '../../resource';
-import { UIRect } from '../core/ui-rect';
import { UINode } from '../core/ui-node';
import { UIRenderer } from '../core/ui-renderer';
import { FlexContainer, FlexItem } from './flex';
@@ -35,7 +34,6 @@ export class UILayoutPlugin implements Plugin {
name = 'uiLayout';
build(app: App): void {
- registerComponent('UIRect', UIRect);
registerComponent('UINode', UINode);
registerComponent('UIRenderer', UIRenderer);
registerComponent('FlexContainer', FlexContainer);
diff --git a/sdk/src/ui/layout/safe-area.ts b/sdk/src/ui/layout/safe-area.ts
index ee04939ae..ecf7408e7 100644
--- a/sdk/src/ui/layout/safe-area.ts
+++ b/sdk/src/ui/layout/safe-area.ts
@@ -3,7 +3,7 @@
/**
* @file ui/layout/safe-area.ts
* @brief Safe-area concept — component + the PreUpdate system that pushes
- * platform safe-area insets into UIRect offsets, co-located.
+ * platform safe-area insets into UINode insets, co-located.
*
* Part of REARCH_GUI P0: the layout concept (Yoga driver + safe-area) is the
* first concept relocated out of the flat legacy plugins into a cohesive
@@ -18,8 +18,6 @@ import { Res } from '../../resource';
import { defineSystem, Schedule } from '../../system';
import { UICameraInfo } from '../UICameraInfo';
import type { UICameraData } from '../UICameraInfo';
-import { UIRect } from '../core/ui-rect';
-import type { UIRectData } from '../core/ui-rect';
import { UINode } from '../core/ui-node';
import type { UINodeData } from '../core/ui-node';
import { px } from '../core/dimension';
@@ -132,31 +130,6 @@ export class SafeAreaPlugin implements Plugin {
const dpr = platformDevicePixelRatio();
const insetScale = isWeChat() ? (worldH / camera.screenH) : (dpr * worldH / camera.screenH);
- const entities = world.getEntitiesWithComponents([SafeArea, UIRect]);
- for (const entity of entities) {
- const sa = world.get(entity, SafeArea) as SafeAreaData;
- const rect = world.get(entity, UIRect) as UIRectData;
-
- const top = sa.applyTop ? cachedInsets.top * insetScale : 0;
- const bottom = sa.applyBottom ? cachedInsets.bottom * insetScale : 0;
- const left = sa.applyLeft ? cachedInsets.left * insetScale : 0;
- const right = sa.applyRight ? cachedInsets.right * insetScale : 0;
-
- let changed = false;
- if (rect.offsetMin.x !== left || rect.offsetMin.y !== bottom) {
- rect.offsetMin = { x: left, y: bottom };
- changed = true;
- }
- if (rect.offsetMax.x !== -right || rect.offsetMax.y !== -top) {
- rect.offsetMax = { x: -right, y: -top };
- changed = true;
- }
-
- if (changed) {
- world.insert(entity, UIRect, rect);
- }
- }
-
// UINode targets (CSS box): safe-area insets map to the node's
// absolute insets. The node is expected to be position:Absolute.
for (const entity of world.getEntitiesWithComponents([SafeArea, UINode])) {
diff --git a/sdk/src/ui/render/image.ts b/sdk/src/ui/render/image.ts
index fd0c44c6e..c39779ea5 100644
--- a/sdk/src/ui/render/image.ts
+++ b/sdk/src/ui/render/image.ts
@@ -6,12 +6,10 @@ import { registerComponent } from '../../component';
import { defineSystem, Schedule } from '../../system';
import { Image, ImageType, FillMethod, FillOrigin } from '../core/image';
import type { ImageData } from '../core/image';
-import { UIRect } from '../core/ui-rect';
-import type { UIRectData } from '../core/ui-rect';
import { UINode } from '../core/ui-node';
import { UIRenderer, UIVisualType } from '../core/ui-renderer';
import type { UIRendererData } from '../core/ui-renderer';
-import { getEffectiveWidth, getEffectiveHeight, getUINodeWidth, getUINodeHeight, ensureUIRenderer } from '../uiHelpers';
+import { getUINodeWidth, getUINodeHeight, ensureUIRenderer } from '../uiHelpers';
import { SystemLabel, PluginName } from '../../systemLabels';
export class ImagePlugin implements Plugin {
@@ -25,7 +23,6 @@ export class ImagePlugin implements Plugin {
const lastRenderedTick = new Map<Entity, number>();
world.enableChangeTracking(Image);
- world.enableChangeTracking(UIRect);
world.enableChangeTracking(UINode);
app.addSystemToSchedule(Schedule.PreUpdate, defineSystem(
@@ -41,16 +38,12 @@ export class ImagePlugin implements Plugin {
for (const entity of entities) {
const image = world.get(entity, Image) as ImageData;
- const uiRect = world.has(entity, UIRect)
- ? world.get(entity, UIRect) as UIRectData
- : null;
const hasNode = world.has(entity, UINode);
const prevTick = lastRenderedTick.get(entity);
if (prevTick !== undefined && world.has(entity, UIRenderer)) {
const imageChanged = world.isChangedSince(entity, Image, prevTick);
- const boxChanged = (uiRect && world.isChangedSince(entity, UIRect, prevTick))
- || (hasNode && world.isChangedSince(entity, UINode, prevTick));
+ const boxChanged = hasNode && world.isChangedSince(entity, UINode, prevTick);
if (!imageChanged && !boxChanged) continue;
}
@@ -101,8 +94,8 @@ export class ImagePlugin implements Plugin {
}
}
} else if (image.imageType === ImageType.Tiled) {
- const w = hasNode ? getUINodeWidth(entity) : uiRect ? getEffectiveWidth(uiRect, entity) : 0;
- const h = hasNode ? getUINodeHeight(entity) : uiRect ? getEffectiveHeight(uiRect, entity) : 0;
+ const w = hasNode ? getUINodeWidth(entity) : 0;
+ const h = hasNode ? getUINodeHeight(entity) : 0;
if (image.tileSize.x > 0 && image.tileSize.y > 0) {
renderer.uvScale = { x: w / image.tileSize.x, y: h / image.tileSize.y };
}
diff --git a/sdk/src/ui/text/layout.ts b/sdk/src/ui/text/layout.ts
index cdc5a0fe8..0f089ca0b 100644
--- a/sdk/src/ui/text/layout.ts
+++ b/sdk/src/ui/text/layout.ts
@@ -91,7 +91,7 @@ export interface GlyphVertexData {
* glyphs (typically the subset that shares one atlas page — see TextRenderer).
* Atlas v0 (top) maps to the screen-top corner, v1 (bottom) to screen-bottom,
* so the quad samples the glyph upright. `originX/Y` offsets all glyphs (e.g. to
- * place the text by its UIRect-resolved anchor).
+ * place the text by its UINode-resolved box origin).
*/
export function buildGlyphVertices(
glyphs: readonly LaidGlyph[],
diff --git a/sdk/src/ui/text/plugin.ts b/sdk/src/ui/text/plugin.ts
index b8edd180f..189518b3f 100644
--- a/sdk/src/ui/text/plugin.ts
+++ b/sdk/src/ui/text/plugin.ts
@@ -5,8 +5,8 @@
* @brief TextPlugin — renders the `Text` component via the dynamic SDF glyph
* atlas (REARCH_GUI P1.4d), replacing the legacy Canvas2D-per-entity
* path. A pre-flush callback scans Text entities, composes the world
- * transform, places the text inside its UIRect box (no auto-size — the
- * UIRect is the box; rendering never mutates layout) and draws batched
+ * transform, places the text inside its UINode box (no auto-size — the
+ * UINode is the box; rendering never mutates layout) and draws batched
* SDF glyph quads, layered to interleave with sibling UI elements.
*/
import type { App, Plugin } from '../../app';
@@ -17,9 +17,8 @@ import type { Entity } from '../../types';
import { SdfTextRenderer } from './text-renderer';
import { composeTRS, rectTextBox, UI_TEXT_BOLD, UI_TEXT_ITALIC } from './text-transform';
import { Text, type TextData } from '../core/text';
-import { UIRect, type UIRectData } from '../core/ui-rect';
import { UINode } from '../core/ui-node';
-import { getEffectiveWidth, getEffectiveHeight, getUINodeWidth, getUINodeHeight, ensureUIRenderer } from '../uiHelpers';
+import { getUINodeWidth, getUINodeHeight, ensureUIRenderer } from '../uiHelpers';
// Matches C++ UIElementPlugin::UI_BASE_LAYER — UI quads use layer = base + uiOrder.
const UI_BASE_LAYER = 1000;
@@ -35,14 +34,11 @@ export class TextPlugin implements Plugin {
const world = app.world;
- // A Text node inside a UIRect is a UI render node: ensure it carries a
+ // A Text node inside a UINode is a UI render node: ensure it carries a
// UIRenderer (visualType None — not drawn as a quad) so the UI
// render-order pass assigns it a uiOrder and the SDF glyphs sort with
// sibling UI elements. Idempotent; runs before the PostUpdate order pass.
app.addSystemToSchedule(Schedule.PreUpdate, defineSystem([], () => {
- for (const e of world.getEntitiesWithComponents([Text, UIRect])) {
- ensureUIRenderer(world, e as Entity);
- }
for (const e of world.getEntitiesWithComponents([Text, UINode])) {
ensureUIRenderer(world, e as Entity);
}
@@ -71,7 +67,7 @@ export class TextPlugin implements Plugin {
const lineHeightPx = t.lineHeight > 0 ? t.lineHeight * t.fontSize : undefined;
// The layout box: a UINode (CSS box, pivot-centered) or legacy
- // UIRect. Text is placed + aligned + wrapped inside it and sorted
+ // UINode. Text is placed + aligned + wrapped inside it and sorted
// by the UI render order. No box ⇒ a world-space label at the
// entity origin, layer 0.
let originX: number | undefined;
@@ -79,21 +75,14 @@ export class TextPlugin implements Plugin {
let maxWidth: number | undefined;
let boxHeight: number | undefined;
let layer = 0;
- let w = 0, h = 0, pivotX = 0.5, pivotY = 0.5, hasBox = false;
+ let w = 0, h = 0, hasBox = false;
if (world.has(entity, UINode)) {
w = getUINodeWidth(entity);
h = getUINodeHeight(entity);
hasBox = w > 0 || h > 0;
- } else if (world.has(entity, UIRect)) {
- const rect = world.get(entity, UIRect) as UIRectData;
- w = getEffectiveWidth(rect, entity);
- h = getEffectiveHeight(rect, entity);
- pivotX = rect.pivot.x;
- pivotY = rect.pivot.y;
- hasBox = true;
}
if (hasBox) {
- const box = rectTextBox(pivotX, pivotY, w, h, t.fontSize);
+ const box = rectTextBox(0.5, 0.5, w, h, t.fontSize);
originX = box.originX;
originY = box.originY;
boxHeight = box.boxHeight;
diff --git a/sdk/src/ui/text/text-transform.ts b/sdk/src/ui/text/text-transform.ts
index 94c72b6be..355466250 100644
--- a/sdk/src/ui/text/text-transform.ts
+++ b/sdk/src/ui/text/text-transform.ts
@@ -34,11 +34,11 @@ export function composeTRS(out: Float32Array, t: Vec3, q: Quat, s: Vec3): Float3
}
/**
- * Place a text block inside a UIRect. The entity Transform sits at the rect's
+ * Place a text block inside a UINode box. The entity Transform sits at the box's
* pivot (UI layout positions the pivot), so glyph local positions (baseline y=0,
- * y-up) are offset to the rect's top-left; the rect width is the wrap/align box
+ * y-up) are offset to the box's top-left; the box width is the wrap/align area
* and `boxHeight` lets the renderer apply vertical alignment. Top-vertical by
- * default: the first line's baseline is one ascent below the rect top
+ * default: the first line's baseline is one ascent below the box top
* (ascent ≈ fontSize × 0.8). Pure.
*/
export function rectTextBox(
diff --git a/sdk/src/ui/uiHelpers.ts b/sdk/src/ui/uiHelpers.ts
index 6d15c2267..5b73ef70f 100644
--- a/sdk/src/ui/uiHelpers.ts
+++ b/sdk/src/ui/uiHelpers.ts
@@ -7,8 +7,6 @@ import { Image } from './core/image';
import type { ImageData } from './core/image';
import type { Entity, Color } from '../types';
import type { World } from '../world';
-import { UIRect } from './core/ui-rect';
-import type { UIRectData } from './core/ui-rect';
import { UIRenderer, UIVisualType } from './core/ui-renderer';
import type { UIRendererData } from './core/ui-renderer';
import { FillDirection } from './uiTypes';
@@ -16,73 +14,6 @@ import type { ColorTransition } from './uiTypes';
import type { ESEngineModule, CppRegistry } from '../wasm';
import { Interactable } from './behavior/interactable';
-export interface LayoutRect {
- left: number;
- bottom: number;
- right: number;
- top: number;
-}
-
-export interface LayoutResult {
- originX: number;
- originY: number;
- width: number;
- height: number;
- rect: LayoutRect;
-}
-
-export function computeUIRectLayout(
- anchorMin: { x: number; y: number },
- anchorMax: { x: number; y: number },
- offsetMin: { x: number; y: number },
- offsetMax: { x: number; y: number },
- size: { x: number; y: number },
- parentRect: LayoutRect,
- pivot: { x: number; y: number } = { x: 0.5, y: 0.5 },
-): LayoutResult {
- const parentW = parentRect.right - parentRect.left;
- const parentH = parentRect.top - parentRect.bottom;
-
- const aLeft = parentRect.left + anchorMin.x * parentW;
- const aRight = parentRect.left + anchorMax.x * parentW;
- const aBottom = parentRect.bottom + anchorMin.y * parentH;
- const aTop = parentRect.bottom + anchorMax.y * parentH;
-
- let myLeft: number;
- let myBottom: number;
- let myRight: number;
- let myTop: number;
-
- if (anchorMin.x === anchorMax.x) {
- myLeft = aLeft + offsetMin.x - size.x * pivot.x;
- myRight = myLeft + size.x;
- } else {
- myLeft = aLeft + offsetMin.x;
- myRight = aRight + offsetMax.x;
- }
-
- if (anchorMin.y === anchorMax.y) {
- myBottom = aBottom + offsetMin.y - size.y * pivot.y;
- myTop = myBottom + size.y;
- } else {
- myBottom = aBottom + offsetMin.y;
- myTop = aTop + offsetMax.y;
- }
-
- const width = Math.max(0, myRight - myLeft);
- const height = Math.max(0, myTop - myBottom);
- const originX = myLeft + pivot.x * width;
- const originY = myBottom + pivot.y * height;
-
- return {
- originX,
- originY,
- width,
- height,
- rect: { left: myLeft, bottom: myBottom, right: myRight, top: myTop },
- };
-}
-
const bridge = new CoreApiBridge('uiHelpers');
let module_: ESEngineModule | null = null;
let nativeRegistry_: CppRegistry | null = null;
@@ -94,85 +25,6 @@ export function initUIHelpers(module: ESEngineModule, registry: CppRegistry): vo
}
-interface FillAnchors {
- anchorMin: { x: number; y: number };
- anchorMax: { x: number; y: number };
- offsetMin: { x: number; y: number };
- offsetMax: { x: number; y: number };
-}
-
-export function computeFillAnchors(direction: number, value: number): FillAnchors {
- switch (direction) {
- case FillDirection.RightToLeft:
- return {
- anchorMin: { x: 1 - value, y: 0 }, anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 0, y: 0 }, offsetMax: { x: 0, y: 0 },
- };
- case FillDirection.BottomToTop:
- return {
- anchorMin: { x: 0, y: 0 }, anchorMax: { x: 1, y: value },
- offsetMin: { x: 0, y: 0 }, offsetMax: { x: 0, y: 0 },
- };
- case FillDirection.TopToBottom:
- return {
- anchorMin: { x: 0, y: 1 - value }, anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 0, y: 0 }, offsetMax: { x: 0, y: 0 },
- };
- default:
- return {
- anchorMin: { x: 0, y: 0 }, anchorMax: { x: value, y: 1 },
- offsetMin: { x: 0, y: 0 }, offsetMax: { x: 0, y: 0 },
- };
- }
-}
-
-export function computeHandleAnchors(
- direction: number, value: number,
-): { anchorMin: { x: number; y: number }; anchorMax: { x: number; y: number } } {
- switch (direction) {
- case FillDirection.RightToLeft:
- return { anchorMin: { x: 1 - value, y: 0.5 }, anchorMax: { x: 1 - value, y: 0.5 } };
- case FillDirection.BottomToTop:
- return { anchorMin: { x: 0.5, y: value }, anchorMax: { x: 0.5, y: value } };
- case FillDirection.TopToBottom:
- return { anchorMin: { x: 0.5, y: 1 - value }, anchorMax: { x: 0.5, y: 1 - value } };
- default:
- return { anchorMin: { x: value, y: 0.5 }, anchorMax: { x: value, y: 0.5 } };
- }
-}
-
-export function computeFillSize(
- direction: number, value: number, parentW: number, parentH: number,
-): { x: number; y: number } {
- switch (direction) {
- case FillDirection.BottomToTop:
- case FillDirection.TopToBottom:
- return { x: parentW, y: parentH * value };
- default:
- return { x: parentW * value, y: parentH };
- }
-}
-
-export function applyDirectionalFill(
- world: World,
- fillEntity: Entity,
- direction: number,
- value: number,
-): void {
- if (!world.has(fillEntity, UIRect)) return;
- const fillRect = world.get(fillEntity, UIRect) as UIRectData;
- const anchors = computeFillAnchors(direction, value);
- fillRect.anchorMin = anchors.anchorMin;
- fillRect.anchorMax = anchors.anchorMax;
- if (anchors.anchorMin.x === anchors.anchorMax.x) {
- fillRect.size = { ...fillRect.size, x: 0 };
- }
- if (anchors.anchorMin.y === anchors.anchorMax.y) {
- fillRect.size = { ...fillRect.size, y: 0 };
- }
- world.insert(fillEntity, UIRect, fillRect);
-}
-
export function applyColorTransition(
transition: ColorTransition,
enabled: boolean,
@@ -294,22 +146,6 @@ export function getEntityDepth(world: World, entity: Entity): number {
return depth;
}
-export function getEffectiveWidth(rect: UIRectData, entity: Entity): number {
- if (module_ && nativeRegistry_) {
- const w = module_.getUIRectComputedWidth(nativeRegistry_, entity);
- if (w > 0) return w;
- }
- return rect.size.x;
-}
-
-export function getEffectiveHeight(rect: UIRectData, entity: Entity): number {
- if (module_ && nativeRegistry_) {
- const h = module_.getUIRectComputedHeight(nativeRegistry_, entity);
- if (h > 0) return h;
- }
- return rect.size.y;
-}
-
/** Resolved px width of a UINode (its Yoga-computed size; REARCH_GUI F3). 0 if unresolved. */
export function getUINodeWidth(entity: Entity): number {
if (module_ && nativeRegistry_ && module_.getUINodeComputedWidth) {
@@ -326,11 +162,6 @@ export function getUINodeHeight(entity: Entity): number {
return 0;
}
-export function setUIRectSizeNative(entity: Entity, w: number, h: number): void {
- if (module_ && nativeRegistry_) {
- module_.setUIRectSize(nativeRegistry_, entity, w, h);
- }
-}
export function syncFillSpriteSize(
world: World,
diff --git a/sdk/src/ui/widgets/helpers.ts b/sdk/src/ui/widgets/helpers.ts
index f9902b5bd..cd5702ace 100644
--- a/sdk/src/ui/widgets/helpers.ts
+++ b/sdk/src/ui/widgets/helpers.ts
@@ -7,7 +7,6 @@ import {
import type { Entity, Vec2 } from '../../types';
import type { World } from '../../world';
-import { UIRect, type UIRectData } from '../core/ui-rect';
import { UINode, UIPositionType, type UINodeData } from '../core/ui-node';
import { px, percent, auto, type Dimension } from '../core/dimension';
import { UIRenderer, UIVisualType, type UIRendererData } from '../core/ui-renderer';
@@ -25,30 +24,6 @@ export function identityTransform(): TransformData {
};
}
-export interface UIRectInit {
- anchorMin?: Vec2;
- anchorMax?: Vec2;
- offsetMin?: Vec2;
- offsetMax?: Vec2;
- size?: Vec2;
- pivot?: Vec2;
-}
-
-/**
- * Default rect covers the full parent (stretched anchors). Override with
- * size + pivot for fixed-size elements.
- */
-export function buildUIRect(init: UIRectInit = {}): UIRectData {
- return {
- anchorMin: init.anchorMin ?? { x: 0, y: 0 },
- anchorMax: init.anchorMax ?? { x: 1, y: 1 },
- offsetMin: init.offsetMin ?? { x: 0, y: 0 },
- offsetMax: init.offsetMax ?? { x: 0, y: 0 },
- size: init.size ?? { x: 0, y: 0 },
- pivot: init.pivot ?? { x: 0.5, y: 0.5 },
- };
-}
-
export interface UINodeInit {
/** Stretch to fill the parent (absolute + inset 0 on all edges). */
fill?: boolean;
@@ -150,16 +125,14 @@ export function buildText(init: TextInit = {}): TextData {
export interface UIEntityInit {
world: World;
parent?: Entity;
- /** Modern CSS-box layout (preferred). */
+ /** CSS-box layout (defaults to fill the parent). */
node?: UINodeInit;
- /** Legacy RectTransform layout (used until a widget is migrated to `node`). */
- rect?: UIRectInit;
renderer?: UIRendererInit;
text?: TextInit;
}
/**
- * Spawn a UI entity with Transform + UIRect, optionally UIRenderer and
+ * Spawn a UI entity with Transform + UINode, optionally UIRenderer and
* Text, optionally parented. Returns the entity.
*
* Widgets compose with this to avoid repeating the same insert dance.
@@ -169,12 +142,7 @@ export function spawnUIEntity(init: UIEntityInit): Entity {
const entity = world.spawn();
world.insert(entity, Transform, identityTransform());
- // Prefer the modern UINode box; legacy UIRect only until the caller migrates.
- if (init.node) {
- world.insert(entity, UINode, buildUINode(init.node));
- } else {
- world.insert(entity, UIRect, buildUIRect(init.rect));
- }
+ world.insert(entity, UINode, buildUINode(init.node));
if (init.renderer) {
world.insert(entity, UIRenderer, buildUIRenderer(init.renderer));
diff --git a/sdk/src/wasm.generated.ts b/sdk/src/wasm.generated.ts
index 31e9082bd..bdb5a6fb8 100644
--- a/sdk/src/wasm.generated.ts
+++ b/sdk/src/wasm.generated.ts
@@ -458,15 +458,6 @@ export interface UINode {
insetBottom: Dimension;
}
-export interface UIRect {
- anchorMin: Vec2;
- anchorMax: Vec2;
- offsetMin: Vec2;
- offsetMax: Vec2;
- size: Vec2;
- pivot: Vec2;
-}
-
export interface UIRenderer {
visualType: number;
texture: number;
@@ -590,10 +581,6 @@ export interface Registry {
getUINode(entity: Entity): UINode;
addUINode(entity: Entity, component: UINode): void;
removeUINode(entity: Entity): void;
- hasUIRect(entity: Entity): boolean;
- getUIRect(entity: Entity): UIRect;
- addUIRect(entity: Entity, component: UIRect): void;
- removeUIRect(entity: Entity): void;
hasUIRenderer(entity: Entity): boolean;
getUIRenderer(entity: Entity): UIRenderer;
addUIRenderer(entity: Entity, component: UIRenderer): void;
@@ -641,7 +628,6 @@ export interface ESEngineModule {
UIInteraction: new () => UIInteraction;
UIMask: new () => UIMask;
UINode: new () => UINode;
- UIRect: new () => UIRect;
UIRenderer: new () => UIRenderer;
Velocity: new () => Velocity;
}
diff --git a/sdk/src/wasm.ts b/sdk/src/wasm.ts
index daa053f37..64407aed0 100644
--- a/sdk/src/wasm.ts
+++ b/sdk/src/wasm.ts
@@ -333,18 +333,16 @@ export interface ESEngineModule {
uiHitTest_getHitEntityPrev(): number;
uiRenderOrder_update(registry: CppRegistry): void;
uiFlexLayout_update(registry: CppRegistry): void;
- getUIRectComputedWidth(registry: CppRegistry, entity: number): number;
- getUIRectComputedHeight(registry: CppRegistry, entity: number): number;
getUINodeComputedWidth?(registry: CppRegistry, entity: number): number;
getUINodeComputedHeight?(registry: CppRegistry, entity: number): number;
- setUIRectSize(registry: CppRegistry, entity: number, w: number, h: number): void;
uiTree_markStructureDirty(): void;
uiTree_markDirty(entity: number): void;
uiTree_markAllDirty(): void;
transform_update(registry: CppRegistry): void;
+ // Layout anim-override flags (function names predate the UINode rename; they
+ // now operate on UINode.anim_override_).
uiRect_clearAnimOverrides(registry: CppRegistry): void;
uiRect_setAnimOverride(registry: CppRegistry, entity: number, flags: number): void;
- uiRect_patchOffset(registry: CppRegistry, entity: number, minX: number, minY: number, maxX: number, maxY: number): void;
transform_patchPosition(registry: CppRegistry, entity: number, x: number, y: number, z: number): void;
// Animation (Tween) API
@@ -367,7 +365,6 @@ export interface ESEngineModule {
getSpritePtr(registry: CppRegistry, entity: number): number;
getVelocityPtr(registry: CppRegistry, entity: number): number;
getCameraPtr(registry: CppRegistry, entity: number): number;
- getUIRectPtr(registry: CppRegistry, entity: number): number;
getRigidBodyPtr(registry: CppRegistry, entity: number): number;
getBoxColliderPtr(registry: CppRegistry, entity: number): number;
getCircleColliderPtr(registry: CppRegistry, entity: number): number;
diff --git a/sdk/tests/emscripten-wrapper.test.ts b/sdk/tests/emscripten-wrapper.test.ts
index 04daf243b..00ccfb0e4 100644
--- a/sdk/tests/emscripten-wrapper.test.ts
+++ b/sdk/tests/emscripten-wrapper.test.ts
@@ -1,16 +1,37 @@
// SPDX-License-Identifier: LicenseRef-PolyForm-Noncommercial-1.0.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
/**
- * Diagnostic test: verify Object.entries behavior with Emscripten reference wrappers
+ * @file emscripten-wrapper.test.ts
+ * @brief Diagnostic: verify Object.entries / getter-setter / world.insert
+ * behaviour for Emscripten value-object reference wrappers, exercised
+ * through UINode's nested `Dimension` structs (the UIRect anchor
+ * structs this used to probe were retired in REARCH_GUI F3).
*/
import { describe, it, expect, beforeAll } from 'vitest';
import { App } from '../src/app';
-import { Transform } from '../src/component';
-import { UIRect } from '../src/ui/core/ui-rect';
-import type { UIRectData } from '../src/ui/core/ui-rect';
+import { UINode, type UINodeData } from '../src/ui/core/ui-node';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
import { loadWasmModule, HAS_WASM } from './helpers/loadWasm';
+/** px / auto Dimension literals (unit 0 = Px, 2 = Auto). */
+const px = (v: number) => ({ value: v, unit: 0 });
+const auto = () => ({ value: 0, unit: 2 });
+
+/** A complete UINode value-object (embind requires every member present). */
+function fullNode(over: Partial<UINodeData> = {}): UINodeData {
+ return {
+ position: 0,
+ width: auto(), height: auto(),
+ minWidth: auto(), minHeight: auto(),
+ maxWidth: auto(), maxHeight: auto(),
+ flexGrow: 0, flexShrink: 1, flexBasis: auto(),
+ alignSelf: 0,
+ marginLeft: px(0), marginTop: px(0), marginRight: px(0), marginBottom: px(0),
+ insetLeft: auto(), insetTop: auto(), insetRight: auto(), insetBottom: auto(),
+ ...over,
+ } as UINodeData;
+}
+
describe.skipIf(!HAS_WASM)('Emscripten wrapper diagnostics', () => {
let module: ESEngineModule;
@@ -18,67 +39,26 @@ describe.skipIf(!HAS_WASM)('Emscripten wrapper diagnostics', () => {
module = await loadWasmModule();
});
- it('Object.entries on Emscripten getUIRect reference wrapper', () => {
+ it('Object.entries on Emscripten getUINode reference wrapper', () => {
const registry = new module.Registry() as unknown as CppRegistry;
const entity = registry.create();
- // Add UIRect with specific values
- registry.addUIRect(entity, {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 0.5, y: 1 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: 50, y: 50 },
- pivot: { x: 0.5, y: 0.5 },
- } as any);
-
- // Get the reference wrapper
- const ref = registry.getUIRect(entity);
-
- // Check values via getter
- console.log('=== Direct property access ===');
- console.log('ref.anchorMin:', JSON.stringify(ref.anchorMin));
- console.log('ref.anchorMax:', JSON.stringify(ref.anchorMax));
- console.log('ref.size:', JSON.stringify(ref.size));
-
- // Check Object.entries
- const entries = Object.entries(ref as any);
- console.log('\n=== Object.entries ===');
- console.log('entries length:', entries.length);
- console.log('entries:', JSON.stringify(entries));
-
- // Check Object.keys
- const keys = Object.keys(ref as any);
- console.log('\n=== Object.keys ===');
- console.log('keys:', JSON.stringify(keys));
-
- // Check own property names
- const ownProps = Object.getOwnPropertyNames(ref as any);
- console.log('\n=== Object.getOwnPropertyNames ===');
- console.log('ownProps:', JSON.stringify(ownProps));
-
- // Check own property descriptors
- const descs = Object.getOwnPropertyDescriptors(ref as any);
- console.log('\n=== Own property descriptors ===');
- for (const [k, d] of Object.entries(descs)) {
- console.log(` ${k}: value=${d.value}, get=${typeof d.get}, set=${typeof d.set}, enum=${d.enumerable}`);
- }
-
- // Check prototype properties
- const proto = Object.getPrototypeOf(ref);
- if (proto) {
- const protoDescs = Object.getOwnPropertyDescriptors(proto);
- console.log('\n=== Prototype property descriptors ===');
- for (const [k, d] of Object.entries(protoDescs)) {
- console.log(` ${k}: value=${typeof d.value}, get=${typeof d.get}, set=${typeof d.set}, enum=${d.enumerable}`);
- }
- }
-
- expect(ref.anchorMax.x).toBeCloseTo(0.5, 5);
- expect(ref.anchorMax.y).toBeCloseTo(1, 5);
+ registry.addUINode(entity, fullNode({ width: px(50), height: px(50) }) as never);
+
+ const ref = registry.getUINode(entity);
+
+ // The nested Dimension wrapper must read back via its getter.
+ expect(ref.width.value).toBeCloseTo(50, 5);
+ expect(ref.width.unit).toBe(0);
+ expect(ref.height.value).toBeCloseTo(50, 5);
+
+ // Object.* introspection on the embind reference wrapper must not throw.
+ expect(() => Object.entries(ref as unknown as object)).not.toThrow();
+ expect(() => Object.keys(ref as unknown as object)).not.toThrow();
+ expect(() => Object.getOwnPropertyNames(ref as unknown as object)).not.toThrow();
registry.destroy(entity);
- (registry as any).delete();
+ (registry as unknown as { delete(): void }).delete();
});
it('world.insert with Emscripten wrapper preserves values', () => {
@@ -89,82 +69,49 @@ describe.skipIf(!HAS_WASM)('Emscripten wrapper diagnostics', () => {
const world = app.world;
const entity = world.spawn();
- // Insert UIRect with specific stretch anchors
- world.insert(entity, UIRect, {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 },
- pivot: { x: 0.5, y: 0.5 },
- });
-
- // Get the reference wrapper
- const ref = world.get(entity, UIRect) as UIRectData;
-
- console.log('\n=== Before modification ===');
- console.log('anchorMax:', JSON.stringify(ref.anchorMax));
-
- // Modify via wrapper (like applyDirectionalFill does)
- ref.anchorMin = { x: 0, y: 0 };
- ref.anchorMax = { x: 0.5, y: 1 };
- ref.offsetMin = { x: 0, y: 0 };
- ref.offsetMax = { x: 0, y: 0 };
-
- console.log('After setter, anchorMax:', JSON.stringify(ref.anchorMax));
-
- // Re-insert (like applyDirectionalFill does)
- world.insert(entity, UIRect, ref);
-
- // Read back
- const after = world.get(entity, UIRect) as UIRectData;
- console.log('\n=== After world.insert ===');
- console.log('anchorMax:', JSON.stringify(after.anchorMax));
- console.log('size:', JSON.stringify(after.size));
- console.log('pivot:', JSON.stringify(after.pivot));
-
- // THIS IS THE KEY CHECK
- expect(after.anchorMax.x).toBeCloseTo(0.5, 5);
- expect(after.anchorMax.y).toBeCloseTo(1, 5);
- expect(after.anchorMin.x).toBeCloseTo(0, 5);
- expect(after.anchorMin.y).toBeCloseTo(0, 5);
+ world.insert(entity, UINode, fullNode());
+
+ const ref = world.get(entity, UINode) as UINodeData;
+
+ // Modify nested struct fields via the wrapper setters.
+ ref.width = px(120);
+ ref.height = px(64);
+ ref.position = 1;
+
+ expect(ref.width.value).toBeCloseTo(120, 5);
+
+ // Re-insert the wrapper and read back: values must survive the round-trip.
+ world.insert(entity, UINode, ref);
+
+ const after = world.get(entity, UINode) as UINodeData;
+ expect(after.width.value).toBeCloseTo(120, 5);
+ expect(after.width.unit).toBe(0);
+ expect(after.height.value).toBeCloseTo(64, 5);
+ expect(after.position).toBe(1);
world.despawn(entity);
world.disconnectCpp();
- (registry as any).delete();
+ (registry as unknown as { delete(): void }).delete();
});
it('nested field modification on Emscripten wrapper', () => {
const registry = new module.Registry() as unknown as CppRegistry;
const entity = registry.create();
- registry.addUIRect(entity, {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: 200, y: 200 },
- pivot: { x: 0.5, y: 0.5 },
- } as any);
-
- const ref = registry.getUIRect(entity);
+ registry.addUINode(entity, fullNode({ width: px(200), height: px(200) }) as never);
- // Try nested modification (the problematic pattern from syncHandleRect)
- console.log('\n=== Nested field modification ===');
- console.log('Before: anchorMin.x =', ref.anchorMin.x);
+ const ref = registry.getUINode(entity);
- // This modifies a COPY, not C++ memory
- ref.anchorMin.x = 0.7;
- console.log('After ref.anchorMin.x = 0.7, actual value =', ref.anchorMin.x);
+ // Mutating a nested member in place writes to a COPY, not C++ memory…
+ ref.width.value = 0.7;
- // This SHOULD write to C++ memory
- ref.anchorMin = { x: 0.7, y: 0.3 };
- console.log('After ref.anchorMin = {0.7, 0.3}, actual value =', ref.anchorMin.x, ref.anchorMin.y);
+ // …whereas assigning a whole Dimension struct writes through.
+ ref.width = px(140);
- expect(ref.anchorMin.x).toBeCloseTo(0.7, 5);
- expect(ref.anchorMin.y).toBeCloseTo(0.3, 5);
+ expect(ref.width.value).toBeCloseTo(140, 5);
+ expect(ref.width.unit).toBe(0);
registry.destroy(entity);
- (registry as any).delete();
+ (registry as unknown as { delete(): void }).delete();
});
});
diff --git a/sdk/tests/scene.test.ts b/sdk/tests/scene.test.ts
index 81595aad8..240dc6afa 100644
--- a/sdk/tests/scene.test.ts
+++ b/sdk/tests/scene.test.ts
@@ -35,15 +35,6 @@ const Transform = defineBuiltin('Transform', {
scale: { x: 1, y: 1, z: 1 },
});
-const UIRect = defineBuiltin('UIRect', {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: 100, y: 100 },
- pivot: { x: 0.5, y: 0.5 },
-});
-
const UIMask = defineBuiltin('UIMask', {
mode: 0,
enabled: true,
@@ -291,22 +282,6 @@ describe('Scene', () => {
).toBe('Transform');
});
- it('splits legacy UIRect.anchor into anchorMin/anchorMax', () => {
- const { data } = migrateSceneData(oneCompScene({ type: 'UIRect', data: { anchor: { x: 0.5, y: 0.5 } } }));
- const d = data.entities[0].components[0].data;
- expect(d.anchorMin).toEqual({ x: 0.5, y: 0.5 });
- expect(d.anchorMax).toEqual({ x: 0.5, y: 0.5 });
- expect(d.anchor).toBeUndefined();
- });
-
- it('does not overwrite an existing anchorMin', () => {
- const { data } = migrateSceneData(oneCompScene({
- type: 'UIRect',
- data: { anchor: { x: 0, y: 0 }, anchorMin: { x: 0.1, y: 0.1 }, anchorMax: { x: 0.9, y: 0.9 } },
- }));
- expect(data.entities[0].components[0].data.anchorMin).toEqual({ x: 0.1, y: 0.1 });
- });
-
it('converts UIMask mode strings to ints', () => {
expect(migrateSceneData(oneCompScene({ type: 'UIMask', data: { mode: 'scissor' } }))
.data.entities[0].components[0].data.mode).toBe(0);
diff --git a/sdk/tests/timeline-tilemap-ui-bridge.test.ts b/sdk/tests/timeline-tilemap-ui-bridge.test.ts
index bc5b3008b..ad6aca275 100644
--- a/sdk/tests/timeline-tilemap-ui-bridge.test.ts
+++ b/sdk/tests/timeline-tilemap-ui-bridge.test.ts
@@ -11,7 +11,7 @@ import { describe, it, expect, vi, afterEach } from 'vitest';
import { WasmModuleAborted } from '../src/moduleHealth';
import { CoreApiBridge } from '../src/CoreApiBridge';
import { TilemapAPI, initTilemapAPI, shutdownTilemapAPI } from '../src/tilemap/tilemapAPI';
-import { initUIHelpers, setUIRectSizeNative } from '../src/ui/uiHelpers';
+import { initUIHelpers, getUINodeWidth } from '../src/ui/uiHelpers';
import { TimelineApi } from '../src/timeline/TimelineControl';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
import type { Entity } from '../src/types';
@@ -65,7 +65,7 @@ describe('tilemap bridge', () => {
describe('uiHelpers bridge', () => {
function makeModule(): ESEngineModule {
return {
- setUIRectSize: vi.fn(),
+ getUINodeComputedWidth: vi.fn().mockReturnValue(0),
onAbort: undefined,
} as unknown as ESEngineModule;
}
@@ -74,9 +74,9 @@ describe('uiHelpers bridge', () => {
it('routes ui calls through the guard when healthy', () => {
const m = makeModule();
initUIHelpers(m, registry);
- setUIRectSizeNative(1 as unknown as Entity, 10, 20);
- expect((m as unknown as { setUIRectSize: ReturnType<typeof vi.fn> }).setUIRectSize)
- .toHaveBeenCalledWith(registry, 1, 10, 20);
+ getUINodeWidth(1 as unknown as Entity);
+ expect((m as unknown as { getUINodeComputedWidth: ReturnType<typeof vi.fn> }).getUINodeComputedWidth)
+ .toHaveBeenCalledWith(registry, 1);
});
it('refuses ui calls after an abort', () => {
@@ -84,9 +84,9 @@ describe('uiHelpers bridge', () => {
initUIHelpers(m, registry);
abort(m);
let caught: unknown;
- try { setUIRectSizeNative(1 as unknown as Entity, 10, 20); } catch (e) { caught = e; }
+ try { getUINodeWidth(1 as unknown as Entity); } catch (e) { caught = e; }
expect(caught).toBeInstanceOf(WasmModuleAborted);
- expect((caught as WasmModuleAborted).context).toBe('uiHelpers.setUIRectSize');
+ expect((caught as WasmModuleAborted).context).toBe('uiHelpers.getUINodeComputedWidth');
});
});
diff --git a/sdk/tests/timeline-wasm-integration.test.ts b/sdk/tests/timeline-wasm-integration.test.ts
index 14421fc82..b0b205136 100644
--- a/sdk/tests/timeline-wasm-integration.test.ts
+++ b/sdk/tests/timeline-wasm-integration.test.ts
@@ -9,7 +9,6 @@
import { describe, it, expect, beforeAll } from 'vitest';
import { World } from '../src/world';
import { Transform, Children, Name, getComponent } from '../src/component';
-import { UIRect, type UIRectData } from '../src/ui/core/ui-rect';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
import { loadWasmModule, HAS_WASM } from './helpers/loadWasm';
import {
diff --git a/sdk/tests/ui-components.test.ts b/sdk/tests/ui-components.test.ts
index 4a3b62934..06ab34631 100644
--- a/sdk/tests/ui-components.test.ts
+++ b/sdk/tests/ui-components.test.ts
@@ -1,28 +1,64 @@
// SPDX-License-Identifier: LicenseRef-PolyForm-Noncommercial-1.0.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
/**
- * Integration tests: UI components (UIRect, UIMask, FlexContainer, FlexItem,
- * Interactable, UIInteraction, Canvas) via real WASM module.
+ * @file ui-components.test.ts
+ * @brief Integration tests for the UI components (UINode, UIMask,
+ * FlexContainer, FlexItem, Interactable, UIInteraction, Canvas) over
+ * the real WASM module — CRUD plus the single-pass Yoga layout.
*
* Requires pre-built WASM at desktop/public/wasm/esengine.wasm.
* Run `node build-tools/cli.js build -t web` first if missing.
*/
import { describe, it, expect, beforeAll } from 'vitest';
import { App } from '../src/app';
-import { World } from '../src/world';
import { Transform, Sprite, Canvas } from '../src/component';
-import { UIRect } from '../src/ui/core/ui-rect';
+import { UINode, type UINodeData } from '../src/ui/core/ui-node';
import { UIMask, MaskMode } from '../src/ui/core/ui-mask';
import { FlexContainer, FlexDirection, JustifyContent, AlignItems } from '../src/ui/layout/flex';
import { FlexItem } from '../src/ui/layout/flex';
import { Interactable } from '../src/ui/behavior/interactable';
import { UIInteraction } from '../src/ui/behavior/interactable';
-import { UICameraInfo, type UICameraData } from '../src/ui/UICameraInfo';
+import { UICameraInfo } from '../src/ui/UICameraInfo';
import { uiLayoutPlugin } from '../src/ui/UILayoutPlugin';
import { uiRenderOrderPlugin } from '../src/ui/UIRenderOrderPlugin';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
import { loadWasmModule, HAS_WASM } from './helpers/loadWasm';
+// ── Dimension literals (unit 0 = Px, 1 = Percent, 2 = Auto) ─────────────────
+const px = (v: number) => ({ value: v, unit: 0 });
+const pct = (v: number) => ({ value: v, unit: 1 });
+const auto = () => ({ value: 0, unit: 2 });
+
+/** A complete UINode value-object (embind requires every member present). */
+function node(over: Partial<UINodeData> = {}): UINodeData {
+ return {
+ position: 0,
+ width: auto(), height: auto(),
+ minWidth: auto(), minHeight: auto(),
+ maxWidth: auto(), maxHeight: auto(),
+ flexGrow: 0, flexShrink: 1, flexBasis: auto(),
+ alignSelf: 0,
+ marginLeft: px(0), marginTop: px(0), marginRight: px(0), marginBottom: px(0),
+ insetLeft: auto(), insetTop: auto(), insetRight: auto(), insetBottom: auto(),
+ ...over,
+ } as UINodeData;
+}
+
+/** Stretch to fill the parent box (Absolute + inset 0 on all edges). */
+function fillNode(): UINodeData {
+ return node({ position: 1, insetLeft: px(0), insetTop: px(0), insetRight: px(0), insetBottom: px(0) });
+}
+
+/** Fixed-size in-flow box. */
+function sizedNode(w: number, h: number): UINodeData {
+ return node({ width: px(w), height: px(h) });
+}
+
+/** Fill the parent inset by `n` px on every edge (Absolute). */
+function insetNode(n: number): UINodeData {
+ return node({ position: 1, insetLeft: px(n), insetTop: px(n), insetRight: px(n), insetBottom: px(n) });
+}
+
describe.skipIf(!HAS_WASM)('UI Components (WASM integration)', () => {
let module: ESEngineModule;
@@ -55,7 +91,7 @@ describe.skipIf(!HAS_WASM)('UI Components (WASM integration)', () => {
try { world.despawn(e); } catch (_) {}
}
world.disconnectCpp();
- (registry as any).delete();
+ (registry as unknown as { delete(): void }).delete();
}
function setCanvasRect(app: App, left: number, bottom: number, right: number, top: number): void {
@@ -88,57 +124,37 @@ describe.skipIf(!HAS_WASM)('UI Components (WASM integration)', () => {
};
}
- function makeFullRect() {
- return {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 },
- pivot: { x: 0.5, y: 0.5 },
- };
- }
-
- function makeCenterRect(w: number, h: number) {
- return {
- anchorMin: { x: 0.5, y: 0.5 },
- anchorMax: { x: 0.5, y: 0.5 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: w, y: h },
- pivot: { x: 0.5, y: 0.5 },
- };
- }
+ const nodeW = (registry: CppRegistry, e: number) => module.getUINodeComputedWidth!(registry, e);
+ const nodeH = (registry: CppRegistry, e: number) => module.getUINodeComputedHeight!(registry, e);
- describe('UIRect CRUD', () => {
- it('should insert and read UIRect via CppRegistry', () => {
+ describe('UINode CRUD', () => {
+ it('should insert and read UINode via CppRegistry', () => {
const { app, registry } = createEditorApp();
const world = app.world;
const entity = world.spawn();
- world.insert(entity, UIRect, makeCenterRect(200, 100));
+ world.insert(entity, UINode, sizedNode(200, 100));
- expect(registry.hasUIRect(entity)).toBe(true);
+ expect(registry.hasUINode(entity)).toBe(true);
- const rect = registry.getUIRect(entity);
- expect(rect.size.x).toBeCloseTo(200);
- expect(rect.size.y).toBeCloseTo(100);
- expect(rect.pivot.x).toBeCloseTo(0.5);
- expect(rect.pivot.y).toBeCloseTo(0.5);
+ const n = registry.getUINode(entity);
+ expect(n.width.value).toBeCloseTo(200);
+ expect(n.width.unit).toBe(0);
+ expect(n.height.value).toBeCloseTo(100);
disposeApp(app, registry);
});
- it('should remove UIRect', () => {
+ it('should remove UINode', () => {
const { app, registry } = createEditorApp();
const world = app.world;
const entity = world.spawn();
- world.insert(entity, UIRect, makeFullRect());
- expect(registry.hasUIRect(entity)).toBe(true);
+ world.insert(entity, UINode, fillNode());
+ expect(registry.hasUINode(entity)).toBe(true);
- world.remove(entity, UIRect);
- expect(registry.hasUIRect(entity)).toBe(false);
+ world.remove(entity, UINode);
+ expect(registry.hasUINode(entity)).toBe(false);
disposeApp(app, registry);
});
@@ -364,83 +380,61 @@ describe.skipIf(!HAS_WASM)('UI Components (WASM integration)', () => {
});
describe('UI layout with deep hierarchy', () => {
- it('should compute layout for 3-level nested UIRect', async () => {
+ it('should compute layout for 3-level nested UINode', async () => {
const { app, registry } = createEditorApp();
const world = app.world;
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, makeFullRect());
+ world.insert(root, UINode, fillNode());
world.insert(root, Transform, makeTransform());
const mid = world.spawn();
world.setParent(mid, root);
- world.insert(mid, UIRect, {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 20, y: 20 },
- offsetMax: { x: -20, y: -20 },
- size: { x: 0, y: 0 },
- pivot: { x: 0.5, y: 0.5 },
- });
+ world.insert(mid, UINode, insetNode(20));
world.insert(mid, Transform, makeTransform());
const leaf = world.spawn();
world.setParent(leaf, mid);
- world.insert(leaf, UIRect, {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 10, y: 10 },
- offsetMax: { x: -10, y: -10 },
- size: { x: 0, y: 0 },
- pivot: { x: 0.5, y: 0.5 },
- });
+ world.insert(leaf, UINode, insetNode(10));
world.insert(leaf, Transform, makeTransform());
world.insert(leaf, Sprite, makeSprite());
setCanvasRect(app, -400, -300, 400, 300);
await app.tick(1 / 60);
- const rootW = module.getUIRectComputedWidth(registry, root);
- const rootH = module.getUIRectComputedHeight(registry, root);
- expect(rootW).toBeCloseTo(800, 0);
- expect(rootH).toBeCloseTo(600, 0);
+ expect(nodeW(registry, root)).toBeCloseTo(800, 0);
+ expect(nodeH(registry, root)).toBeCloseTo(600, 0);
- const midW = module.getUIRectComputedWidth(registry, mid);
- const midH = module.getUIRectComputedHeight(registry, mid);
- expect(midW).toBeCloseTo(760, 0);
- expect(midH).toBeCloseTo(560, 0);
+ expect(nodeW(registry, mid)).toBeCloseTo(760, 0);
+ expect(nodeH(registry, mid)).toBeCloseTo(560, 0);
- const leafW = module.getUIRectComputedWidth(registry, leaf);
- const leafH = module.getUIRectComputedHeight(registry, leaf);
- expect(leafW).toBeCloseTo(740, 0);
- expect(leafH).toBeCloseTo(540, 0);
+ expect(nodeW(registry, leaf)).toBeCloseTo(740, 0);
+ expect(nodeH(registry, leaf)).toBeCloseTo(540, 0);
disposeApp(app, registry);
});
- it('should compute fixed-size centered child correctly', async () => {
+ it('should compute fixed-size child correctly', async () => {
const { app, registry } = createEditorApp();
const world = app.world;
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, makeFullRect());
+ world.insert(root, UINode, fillNode());
world.insert(root, Transform, makeTransform());
const child = world.spawn();
world.setParent(child, root);
- world.insert(child, UIRect, makeCenterRect(200, 150));
+ world.insert(child, UINode, sizedNode(200, 150));
world.insert(child, Transform, makeTransform());
world.insert(child, Sprite, makeSprite());
setCanvasRect(app, -400, -300, 400, 300);
await app.tick(1 / 60);
- const w = module.getUIRectComputedWidth(registry, child);
- const h = module.getUIRectComputedHeight(registry, child);
- expect(w).toBeCloseTo(200, 0);
- expect(h).toBeCloseTo(150, 0);
+ expect(nodeW(registry, child)).toBeCloseTo(200, 0);
+ expect(nodeH(registry, child)).toBeCloseTo(150, 0);
disposeApp(app, registry);
});
@@ -453,7 +447,7 @@ describe.skipIf(!HAS_WASM)('UI Components (WASM integration)', () => {
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, makeFullRect());
+ world.insert(root, UINode, fillNode());
world.insert(root, Transform, makeTransform());
world.insert(root, Sprite, makeSprite());
@@ -461,7 +455,7 @@ describe.skipIf(!HAS_WASM)('UI Components (WASM integration)', () => {
for (let i = 0; i < 5; i++) {
const child = world.spawn();
world.setParent(child, root);
- world.insert(child, UIRect, makeCenterRect(50, 50));
+ world.insert(child, UINode, sizedNode(50, 50));
world.insert(child, Transform, makeTransform());
world.insert(child, Sprite, makeSprite());
children.push(child);
@@ -485,19 +479,19 @@ describe.skipIf(!HAS_WASM)('UI Components (WASM integration)', () => {
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, makeFullRect());
+ world.insert(root, UINode, fillNode());
world.insert(root, Transform, makeTransform());
world.insert(root, Sprite, makeSprite());
const mid = world.spawn();
world.setParent(mid, root);
- world.insert(mid, UIRect, makeFullRect());
+ world.insert(mid, UINode, fillNode());
world.insert(mid, Transform, makeTransform());
world.insert(mid, Sprite, makeSprite());
const leaf = world.spawn();
world.setParent(leaf, mid);
- world.insert(leaf, UIRect, makeCenterRect(50, 50));
+ world.insert(leaf, UINode, sizedNode(50, 50));
world.insert(leaf, Transform, makeTransform());
world.insert(leaf, Sprite, makeSprite());
@@ -515,142 +509,120 @@ describe.skipIf(!HAS_WASM)('UI Components (WASM integration)', () => {
});
});
- describe('anchor-based layout variations', () => {
- it('should compute left-anchored child (25% width)', async () => {
+ describe('percent / inset sizing variations', () => {
+ it('should compute left child at 25% width, full height', async () => {
const { app, registry } = createEditorApp();
const world = app.world;
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, makeFullRect());
+ world.insert(root, UINode, fillNode());
world.insert(root, Transform, makeTransform());
const child = world.spawn();
world.setParent(child, root);
- world.insert(child, UIRect, {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 0.25, y: 1 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 },
- pivot: { x: 0.5, y: 0.5 },
- });
+ world.insert(child, UINode, node({
+ position: 1,
+ insetLeft: px(0), insetTop: px(0),
+ width: pct(25), height: pct(100),
+ }));
world.insert(child, Transform, makeTransform());
world.insert(child, Sprite, makeSprite());
setCanvasRect(app, -400, -300, 400, 300);
await app.tick(1 / 60);
- const w = module.getUIRectComputedWidth(registry, child);
- const h = module.getUIRectComputedHeight(registry, child);
- expect(w).toBeCloseTo(200, 0);
- expect(h).toBeCloseTo(600, 0);
+ expect(nodeW(registry, child)).toBeCloseTo(200, 0);
+ expect(nodeH(registry, child)).toBeCloseTo(600, 0);
disposeApp(app, registry);
});
- it('should compute bottom-anchored child (50% height)', async () => {
+ it('should compute bottom child at full width, 50% height', async () => {
const { app, registry } = createEditorApp();
const world = app.world;
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, makeFullRect());
+ world.insert(root, UINode, fillNode());
world.insert(root, Transform, makeTransform());
const child = world.spawn();
world.setParent(child, root);
- world.insert(child, UIRect, {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 1, y: 0.5 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 },
- pivot: { x: 0.5, y: 0.5 },
- });
+ world.insert(child, UINode, node({
+ position: 1,
+ insetLeft: px(0), insetBottom: px(0),
+ width: pct(100), height: pct(50),
+ }));
world.insert(child, Transform, makeTransform());
world.insert(child, Sprite, makeSprite());
setCanvasRect(app, -400, -300, 400, 300);
await app.tick(1 / 60);
- const w = module.getUIRectComputedWidth(registry, child);
- const h = module.getUIRectComputedHeight(registry, child);
- expect(w).toBeCloseTo(800, 0);
- expect(h).toBeCloseTo(300, 0);
+ expect(nodeW(registry, child)).toBeCloseTo(800, 0);
+ expect(nodeH(registry, child)).toBeCloseTo(300, 0);
disposeApp(app, registry);
});
- it('should compute offset from edges', async () => {
+ it('should compute fill inset by 50px on every edge', async () => {
const { app, registry } = createEditorApp();
const world = app.world;
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, makeFullRect());
+ world.insert(root, UINode, fillNode());
world.insert(root, Transform, makeTransform());
const child = world.spawn();
world.setParent(child, root);
- world.insert(child, UIRect, {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 50, y: 50 },
- offsetMax: { x: -50, y: -50 },
- size: { x: 0, y: 0 },
- pivot: { x: 0.5, y: 0.5 },
- });
+ world.insert(child, UINode, insetNode(50));
world.insert(child, Transform, makeTransform());
world.insert(child, Sprite, makeSprite());
setCanvasRect(app, -400, -300, 400, 300);
await app.tick(1 / 60);
- const w = module.getUIRectComputedWidth(registry, child);
- const h = module.getUIRectComputedHeight(registry, child);
- expect(w).toBeCloseTo(700, 0);
- expect(h).toBeCloseTo(500, 0);
+ expect(nodeW(registry, child)).toBeCloseTo(700, 0);
+ expect(nodeH(registry, child)).toBeCloseTo(500, 0);
disposeApp(app, registry);
});
});
describe('dynamic layout changes', () => {
- it('should update layout when anchors change between ticks', async () => {
+ it('should update layout when sizing changes between ticks', async () => {
const { app, registry } = createEditorApp();
const world = app.world;
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, makeFullRect());
+ world.insert(root, UINode, fillNode());
world.insert(root, Transform, makeTransform());
const child = world.spawn();
world.setParent(child, root);
- world.insert(child, UIRect, {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 0.5, y: 1 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 },
- pivot: { x: 0.5, y: 0.5 },
- });
+ world.insert(child, UINode, node({
+ position: 1,
+ insetLeft: px(0), insetTop: px(0),
+ width: pct(50), height: pct(100),
+ }));
world.insert(child, Transform, makeTransform());
world.insert(child, Sprite, makeSprite());
setCanvasRect(app, -400, -300, 400, 300);
await app.tick(1 / 60);
- expect(module.getUIRectComputedWidth(registry, child)).toBeCloseTo(400, 0);
+ expect(nodeW(registry, child)).toBeCloseTo(400, 0);
- const rect = registry.getUIRect(child);
- rect.anchorMax.x = 1;
- registry.addUIRect(child, rect);
+ const n = registry.getUINode(child);
+ n.width = pct(100);
+ registry.addUINode(child, n);
await app.tick(1 / 60);
- expect(module.getUIRectComputedWidth(registry, child)).toBeCloseTo(800, 0);
+ expect(nodeW(registry, child)).toBeCloseTo(800, 0);
disposeApp(app, registry);
});
@@ -661,7 +633,7 @@ describe.skipIf(!HAS_WASM)('UI Components (WASM integration)', () => {
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, makeFullRect());
+ world.insert(root, UINode, fillNode());
world.insert(root, Transform, makeTransform());
setCanvasRect(app, -400, -300, 400, 300);
@@ -669,16 +641,14 @@ describe.skipIf(!HAS_WASM)('UI Components (WASM integration)', () => {
const child = world.spawn();
world.setParent(child, root);
- world.insert(child, UIRect, makeCenterRect(300, 200));
+ world.insert(child, UINode, sizedNode(300, 200));
world.insert(child, Transform, makeTransform());
world.insert(child, Sprite, makeSprite());
await app.tick(1 / 60);
- const w = module.getUIRectComputedWidth(registry, child);
- const h = module.getUIRectComputedHeight(registry, child);
- expect(w).toBeCloseTo(300, 0);
- expect(h).toBeCloseTo(200, 0);
+ expect(nodeW(registry, child)).toBeCloseTo(300, 0);
+ expect(nodeH(registry, child)).toBeCloseTo(200, 0);
disposeApp(app, registry);
});
@@ -689,21 +659,21 @@ describe.skipIf(!HAS_WASM)('UI Components (WASM integration)', () => {
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, makeFullRect());
+ world.insert(root, UINode, fillNode());
world.insert(root, Transform, makeTransform());
world.insert(root, Sprite, makeSprite());
setCanvasRect(app, -400, -300, 400, 300);
await app.tick(1 / 60);
- expect(module.getUIRectComputedWidth(registry, root)).toBeCloseTo(800, 0);
- expect(module.getUIRectComputedHeight(registry, root)).toBeCloseTo(600, 0);
+ expect(nodeW(registry, root)).toBeCloseTo(800, 0);
+ expect(nodeH(registry, root)).toBeCloseTo(600, 0);
setCanvasRect(app, -500, -400, 500, 400);
await app.tick(1 / 60);
- expect(module.getUIRectComputedWidth(registry, root)).toBeCloseTo(1000, 0);
- expect(module.getUIRectComputedHeight(registry, root)).toBeCloseTo(800, 0);
+ expect(nodeW(registry, root)).toBeCloseTo(1000, 0);
+ expect(nodeH(registry, root)).toBeCloseTo(800, 0);
disposeApp(app, registry);
});
diff --git a/sdk/tests/ui-layout-integration.test.ts b/sdk/tests/ui-layout-integration.test.ts
index ea94c708d..6f8cf38c9 100644
--- a/sdk/tests/ui-layout-integration.test.ts
+++ b/sdk/tests/ui-layout-integration.test.ts
@@ -1,23 +1,80 @@
// SPDX-License-Identifier: LicenseRef-PolyForm-Noncommercial-1.0.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
/**
- * Integration tests: App.tick() drives UI layout via real WASM module.
+ * @file ui-layout-integration.test.ts
+ * @brief Integration tests: App.tick() drives the single-pass UINode Yoga
+ * layout via the real WASM module.
*
* Requires pre-built WASM at desktop/public/wasm/esengine.wasm.
* Run `node build-tools/cli.js build -t web` first if missing.
*/
import { describe, it, expect, beforeAll } from 'vitest';
import { App } from '../src/app';
-import { World } from '../src/world';
-import { UIRect, type UIRectData } from '../src/ui/core/ui-rect';
+import { UINode, type UINodeData } from '../src/ui/core/ui-node';
import { Canvas } from '../src/component';
-import { UICameraInfo, type UICameraData } from '../src/ui/UICameraInfo';
+import { UICameraInfo } from '../src/ui/UICameraInfo';
import { uiLayoutPlugin } from '../src/ui/UILayoutPlugin';
import { uiRenderOrderPlugin } from '../src/ui/UIRenderOrderPlugin';
import { Transform, Sprite } from '../src/component';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
import { loadWasmModule, HAS_WASM } from './helpers/loadWasm';
+// ── Dimension literals (unit 0 = Px, 1 = Percent, 2 = Auto) ─────────────────
+const px = (v: number) => ({ value: v, unit: 0 });
+const pct = (v: number) => ({ value: v, unit: 1 });
+const auto = () => ({ value: 0, unit: 2 });
+
+/** A complete UINode value-object (embind requires every member present). */
+function node(over: Partial<UINodeData> = {}): UINodeData {
+ return {
+ position: 0,
+ width: auto(), height: auto(),
+ minWidth: auto(), minHeight: auto(),
+ maxWidth: auto(), maxHeight: auto(),
+ flexGrow: 0, flexShrink: 1, flexBasis: auto(),
+ alignSelf: 0,
+ marginLeft: px(0), marginTop: px(0), marginRight: px(0), marginBottom: px(0),
+ insetLeft: auto(), insetTop: auto(), insetRight: auto(), insetBottom: auto(),
+ ...over,
+ } as UINodeData;
+}
+
+/** Stretch to fill the parent box (Absolute + inset 0 on all edges). */
+function fillNode(): UINodeData {
+ return node({ position: 1, insetLeft: px(0), insetTop: px(0), insetRight: px(0), insetBottom: px(0) });
+}
+
+/** Fixed-size in-flow box. */
+function sizedNode(w: number, h: number): UINodeData {
+ return node({ width: px(w), height: px(h) });
+}
+
+/** Fill the parent inset by `n` px on every edge (Absolute). */
+function insetNode(n: number): UINodeData {
+ return node({ position: 1, insetLeft: px(n), insetTop: px(n), insetRight: px(n), insetBottom: px(n) });
+}
+
+function makeTransform(x = 0, y = 0) {
+ return {
+ position: { x, y, z: 0 },
+ rotation: { x: 0, y: 0, z: 0, w: 1 },
+ scale: { x: 1, y: 1, z: 1 },
+ };
+}
+
+function makeSprite(w = 100, h = 100) {
+ return {
+ texture: 0,
+ color: { r: 1, g: 1, b: 1, a: 1 },
+ size: { x: w, y: h },
+ uvOffset: { x: 0, y: 0 },
+ uvScale: { x: 1, y: 1 },
+ layer: 0,
+ flipX: false,
+ flipY: false,
+ };
+}
+
describe.skipIf(!HAS_WASM)('UI Layout via App.tick() (WASM integration)', () => {
let module: ESEngineModule;
@@ -50,7 +107,7 @@ describe.skipIf(!HAS_WASM)('UI Layout via App.tick() (WASM integration)', () =>
try { world.despawn(e); } catch (_) {}
}
world.disconnectCpp();
- (registry as any).delete();
+ (registry as unknown as { delete(): void }).delete();
}
function setCanvasRect(app: App, left: number, bottom: number, right: number, top: number): void {
@@ -62,25 +119,17 @@ describe.skipIf(!HAS_WASM)('UI Layout via App.tick() (WASM integration)', () =>
cam.valid = true;
}
+ const nodeW = (registry: CppRegistry, e: number) => module.getUINodeComputedWidth!(registry, e);
+ const nodeH = (registry: CppRegistry, e: number) => module.getUINodeComputedHeight!(registry, e);
+
it('should call uiLayout_update via tick without error', async () => {
const { app, registry } = createEditorApp();
const world = app.world;
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 },
- pivot: { x: 0.5, y: 0.5 },
- });
- world.insert(root, Transform, {
- position: { x: 0, y: 0, z: 0 },
- rotation: { x: 0, y: 0, z: 0, w: 1 },
- scale: { x: 1, y: 1, z: 1 },
- });
+ world.insert(root, UINode, fillNode());
+ world.insert(root, Transform, makeTransform());
setCanvasRect(app, -400, -300, 400, 300);
@@ -89,60 +138,27 @@ describe.skipIf(!HAS_WASM)('UI Layout via App.tick() (WASM integration)', () =>
disposeApp(app, registry);
});
- it('should compute layout for child UIRect entities', async () => {
+ it('should compute layout for child UINode entities', async () => {
const { app, registry } = createEditorApp();
const world = app.world;
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 0, y: 0 },
- offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 },
- pivot: { x: 0.5, y: 0.5 },
- });
- world.insert(root, Transform, {
- position: { x: 0, y: 0, z: 0 },
- rotation: { x: 0, y: 0, z: 0, w: 1 },
- scale: { x: 1, y: 1, z: 1 },
- });
+ world.insert(root, UINode, fillNode());
+ world.insert(root, Transform, makeTransform());
const child = world.spawn();
world.setParent(child, root);
- world.insert(child, UIRect, {
- anchorMin: { x: 0, y: 0 },
- anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 10, y: 10 },
- offsetMax: { x: -10, y: -10 },
- size: { x: 0, y: 0 },
- pivot: { x: 0.5, y: 0.5 },
- });
- world.insert(child, Transform, {
- position: { x: 0, y: 0, z: 0 },
- rotation: { x: 0, y: 0, z: 0, w: 1 },
- scale: { x: 1, y: 1, z: 1 },
- });
- world.insert(child, Sprite, {
- texture: 0,
- color: { r: 1, g: 1, b: 1, a: 1 },
- size: { x: 100, y: 100 },
- uvOffset: { x: 0, y: 0 },
- uvScale: { x: 1, y: 1 },
- layer: 0,
- flipX: false,
- flipY: false,
- });
+ world.insert(child, UINode, insetNode(10));
+ world.insert(child, Transform, makeTransform());
+ world.insert(child, Sprite, makeSprite());
setCanvasRect(app, -400, -300, 400, 300);
await app.tick(1 / 60);
- const computedW = module.getUIRectComputedWidth(registry, child);
- const computedH = module.getUIRectComputedHeight(registry, child);
- expect(computedW).toBeCloseTo(780, 0);
- expect(computedH).toBeCloseTo(580, 0);
+ expect(nodeW(registry, child)).toBeCloseTo(780, 0);
+ expect(nodeH(registry, child)).toBeCloseTo(580, 0);
disposeApp(app, registry);
});
@@ -153,41 +169,15 @@ describe.skipIf(!HAS_WASM)('UI Layout via App.tick() (WASM integration)', () =>
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, {
- anchorMin: { x: 0, y: 0 }, anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 0, y: 0 }, offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 }, pivot: { x: 0.5, y: 0.5 },
- });
- world.insert(root, Transform, {
- position: { x: 0, y: 0, z: 0 },
- rotation: { x: 0, y: 0, z: 0, w: 1 },
- scale: { x: 1, y: 1, z: 1 },
- });
- world.insert(root, Sprite, {
- texture: 0, color: { r: 1, g: 1, b: 1, a: 1 },
- size: { x: 800, y: 600 },
- uvOffset: { x: 0, y: 0 }, uvScale: { x: 1, y: 1 },
- layer: 0, flipX: false, flipY: false,
- });
+ world.insert(root, UINode, fillNode());
+ world.insert(root, Transform, makeTransform());
+ world.insert(root, Sprite, makeSprite(800, 600));
const child = world.spawn();
world.setParent(child, root);
- world.insert(child, UIRect, {
- anchorMin: { x: 0.5, y: 0.5 }, anchorMax: { x: 0.5, y: 0.5 },
- offsetMin: { x: 0, y: 0 }, offsetMax: { x: 0, y: 0 },
- size: { x: 100, y: 100 }, pivot: { x: 0.5, y: 0.5 },
- });
- world.insert(child, Transform, {
- position: { x: 0, y: 0, z: 0 },
- rotation: { x: 0, y: 0, z: 0, w: 1 },
- scale: { x: 1, y: 1, z: 1 },
- });
- world.insert(child, Sprite, {
- texture: 0, color: { r: 1, g: 1, b: 1, a: 1 },
- size: { x: 100, y: 100 },
- uvOffset: { x: 0, y: 0 }, uvScale: { x: 1, y: 1 },
- layer: 0, flipX: false, flipY: false,
- });
+ world.insert(child, UINode, sizedNode(100, 100));
+ world.insert(child, Transform, makeTransform());
+ world.insert(child, Sprite, makeSprite());
setCanvasRect(app, -400, -300, 400, 300);
@@ -200,68 +190,38 @@ describe.skipIf(!HAS_WASM)('UI Layout via App.tick() (WASM integration)', () =>
disposeApp(app, registry);
});
- it('should handle fill anchors for slider-like entities', async () => {
+ it('should handle 50%-width fill for slider-like entities', async () => {
const { app, registry } = createEditorApp();
const world = app.world;
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, {
- anchorMin: { x: 0, y: 0 }, anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 0, y: 0 }, offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 }, pivot: { x: 0.5, y: 0.5 },
- });
- world.insert(root, Transform, {
- position: { x: 0, y: 0, z: 0 },
- rotation: { x: 0, y: 0, z: 0, w: 1 },
- scale: { x: 1, y: 1, z: 1 },
- });
+ world.insert(root, UINode, fillNode());
+ world.insert(root, Transform, makeTransform());
const background = world.spawn();
world.setParent(background, root);
- world.insert(background, UIRect, {
- anchorMin: { x: 0, y: 0 }, anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 0, y: 0 }, offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 }, pivot: { x: 0.5, y: 0.5 },
- });
- world.insert(background, Transform, {
- position: { x: 0, y: 0, z: 0 },
- rotation: { x: 0, y: 0, z: 0, w: 1 },
- scale: { x: 1, y: 1, z: 1 },
- });
- world.insert(background, Sprite, {
- texture: 0, color: { r: 0.5, g: 0.5, b: 0.5, a: 1 },
- size: { x: 200, y: 30 },
- uvOffset: { x: 0, y: 0 }, uvScale: { x: 1, y: 1 },
- layer: 0, flipX: false, flipY: false,
- });
+ world.insert(background, UINode, fillNode());
+ world.insert(background, Transform, makeTransform());
+ world.insert(background, Sprite, makeSprite(200, 30));
const fill = world.spawn();
world.setParent(fill, background);
- world.insert(fill, UIRect, {
- anchorMin: { x: 0, y: 0 }, anchorMax: { x: 0.5, y: 1 },
- offsetMin: { x: 0, y: 0 }, offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 }, pivot: { x: 0.5, y: 0.5 },
- });
- world.insert(fill, Transform, {
- position: { x: 0, y: 0, z: 0 },
- rotation: { x: 0, y: 0, z: 0, w: 1 },
- scale: { x: 1, y: 1, z: 1 },
- });
- world.insert(fill, Sprite, {
- texture: 0, color: { r: 0, g: 0.8, b: 0, a: 1 },
- size: { x: 100, y: 30 },
- uvOffset: { x: 0, y: 0 }, uvScale: { x: 1, y: 1 },
- layer: 0, flipX: false, flipY: false,
- });
+ world.insert(fill, UINode, node({
+ position: 1,
+ insetLeft: px(0), insetTop: px(0),
+ width: pct(50), height: pct(100),
+ }));
+ world.insert(fill, Transform, makeTransform());
+ world.insert(fill, Sprite, makeSprite(100, 30));
setCanvasRect(app, -400, -300, 400, 300);
await app.tick(1 / 60);
- const fillW = module.getUIRectComputedWidth(registry, fill);
- const fillH = module.getUIRectComputedHeight(registry, fill);
- const bgW = module.getUIRectComputedWidth(registry, background);
+ const fillW = nodeW(registry, fill);
+ const fillH = nodeH(registry, fill);
+ const bgW = nodeW(registry, background);
expect(fillW).toBeGreaterThan(0);
expect(fillH).toBeGreaterThan(0);
@@ -276,16 +236,8 @@ describe.skipIf(!HAS_WASM)('UI Layout via App.tick() (WASM integration)', () =>
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, {
- anchorMin: { x: 0, y: 0 }, anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 0, y: 0 }, offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 }, pivot: { x: 0.5, y: 0.5 },
- });
- world.insert(root, Transform, {
- position: { x: 0, y: 0, z: 0 },
- rotation: { x: 0, y: 0, z: 0, w: 1 },
- scale: { x: 1, y: 1, z: 1 },
- });
+ world.insert(root, UINode, fillNode());
+ world.insert(root, Transform, makeTransform());
setCanvasRect(app, -400, -300, 400, 300);
@@ -302,58 +254,34 @@ describe.skipIf(!HAS_WASM)('UI Layout via App.tick() (WASM integration)', () =>
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, UIRect, {
- anchorMin: { x: 0, y: 0 }, anchorMax: { x: 1, y: 1 },
- offsetMin: { x: 0, y: 0 }, offsetMax: { x: 0, y: 0 },
- size: { x: 0, y: 0 }, pivot: { x: 0.5, y: 0.5 },
- });
- world.insert(root, Transform, {
- position: { x: 0, y: 0, z: 0 },
- rotation: { x: 0, y: 0, z: 0, w: 1 },
- scale: { x: 1, y: 1, z: 1 },
- });
+ world.insert(root, UINode, fillNode());
+ world.insert(root, Transform, makeTransform());
const cam = app.getResource(UICameraInfo);
cam.valid = false;
await expect(async () => await app.tick(1 / 60)).not.toThrow();
- const w = module.getUIRectComputedWidth(registry, root);
- expect(w).toBe(0);
+ expect(nodeW(registry, root)).toBe(0);
disposeApp(app, registry);
});
- it('Canvas without UIRect: layout should not overwrite Transform positions', async () => {
+ it('Canvas without UINode: layout should not overwrite Transform positions', async () => {
const { app, registry } = createEditorApp();
const world = app.world;
+ // Root is a Canvas but has no UINode → it is not a layout root, so its
+ // subtree is never laid out and the child Transform is left untouched.
const root = world.spawn();
world.insert(root, Canvas, {});
- world.insert(root, Transform, {
- position: { x: 0, y: 0, z: 0 },
- rotation: { x: 0, y: 0, z: 0, w: 1 },
- scale: { x: 1, y: 1, z: 1 },
- });
+ world.insert(root, Transform, makeTransform());
const child = world.spawn();
world.setParent(child, root);
- world.insert(child, UIRect, {
- anchorMin: { x: 0, y: 0 }, anchorMax: { x: 0, y: 0 },
- offsetMin: { x: 0, y: 0 }, offsetMax: { x: 0, y: 0 },
- size: { x: 200, y: 100 }, pivot: { x: 0.5, y: 0.5 },
- });
- world.insert(child, Transform, {
- position: { x: 50, y: 75, z: 0 },
- rotation: { x: 0, y: 0, z: 0, w: 1 },
- scale: { x: 1, y: 1, z: 1 },
- });
- world.insert(child, Sprite, {
- texture: 0, color: { r: 1, g: 1, b: 1, a: 1 },
- size: { x: 100, y: 100 },
- uvOffset: { x: 0, y: 0 }, uvScale: { x: 1, y: 1 },
- layer: 0, flipX: false, flipY: false,
- });
+ world.insert(child, UINode, sizedNode(200, 100));
+ world.insert(child, Transform, makeTransform(50, 75));
+ world.insert(child, Sprite, makeSprite());
setCanvasRect(app, -400, -300, 400, 300);
await app.tick(1 / 60);
diff --git a/sdk/tests/uiLayout.test.ts b/sdk/tests/uiLayout.test.ts
deleted file mode 100644
index 9ef156bba..000000000
--- a/sdk/tests/uiLayout.test.ts
+++ /dev/null
@@ -1,519 +0,0 @@
-// SPDX-License-Identifier: LicenseRef-PolyForm-Noncommercial-1.0.0
-// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { describe, it, expect } from 'vitest';
-import { computeUIRectLayout } from '../src/ui/uiHelpers';
-import type { LayoutRect, LayoutResult } from '../src/ui/uiHelpers';
-
-const PARENT: LayoutRect = { left: 0, bottom: 0, right: 800, top: 600 };
-
-function noOffset() {
- return { x: 0, y: 0 };
-}
-
-describe('computeUIRectLayout', () => {
- describe('point anchor (anchorMin === anchorMax)', () => {
- it('centers element with default pivot at center anchor', () => {
- const r = computeUIRectLayout(
- { x: 0.5, y: 0.5 },
- { x: 0.5, y: 0.5 },
- noOffset(),
- noOffset(),
- { x: 100, y: 80 },
- PARENT,
- );
- expect(r.width).toBe(100);
- expect(r.height).toBe(80);
- expect(r.originX).toBe(400);
- expect(r.originY).toBe(300);
- expect(r.rect.left).toBe(350);
- expect(r.rect.right).toBe(450);
- expect(r.rect.bottom).toBe(260);
- expect(r.rect.top).toBe(340);
- });
-
- it('positions at top-left with anchor (0, 1)', () => {
- const r = computeUIRectLayout(
- { x: 0, y: 1 },
- { x: 0, y: 1 },
- noOffset(),
- noOffset(),
- { x: 100, y: 80 },
- PARENT,
- );
- // aLeft=0, aBottom=600
- // myLeft = 0 + 0 - 100*0.5 = -50, myRight = 50
- // myBottom = 600 + 0 - 80*0.5 = 560, myTop = 640
- expect(r.originX).toBe(0);
- expect(r.originY).toBe(600);
- expect(r.rect.left).toBe(-50);
- expect(r.rect.right).toBe(50);
- expect(r.rect.bottom).toBe(560);
- expect(r.rect.top).toBe(640);
- });
-
- it('positions at bottom-right with anchor (1, 0)', () => {
- const r = computeUIRectLayout(
- { x: 1, y: 0 },
- { x: 1, y: 0 },
- noOffset(),
- noOffset(),
- { x: 100, y: 80 },
- PARENT,
- );
- // aLeft=800, aBottom=0
- // myLeft = 800 - 50 = 750, myRight = 850
- // myBottom = 0 - 40 = -40, myTop = 40
- expect(r.originX).toBe(800);
- expect(r.originY).toBe(0);
- expect(r.rect.left).toBe(750);
- expect(r.rect.right).toBe(850);
- });
-
- it('shifts position with offset', () => {
- const r = computeUIRectLayout(
- { x: 0.5, y: 0.5 },
- { x: 0.5, y: 0.5 },
- { x: 20, y: -10 },
- noOffset(),
- { x: 100, y: 80 },
- PARENT,
- );
- // aLeft=400, aBottom=300
- // myLeft = 400 + 20 - 50 = 370, myRight = 470
- // myBottom = 300 + (-10) - 40 = 250, myTop = 330
- expect(r.rect.left).toBe(370);
- expect(r.rect.right).toBe(470);
- expect(r.rect.bottom).toBe(250);
- expect(r.rect.top).toBe(330);
- expect(r.originX).toBe(420);
- expect(r.originY).toBe(290);
- });
-
- it('places origin at bottom-left with pivot (0, 0)', () => {
- const r = computeUIRectLayout(
- { x: 0.5, y: 0.5 },
- { x: 0.5, y: 0.5 },
- noOffset(),
- noOffset(),
- { x: 100, y: 80 },
- PARENT,
- { x: 0, y: 0 },
- );
- // myLeft = 400 + 0 - 100*0 = 400, myRight = 500
- // myBottom = 300 + 0 - 80*0 = 300, myTop = 380
- expect(r.rect.left).toBe(400);
- expect(r.rect.right).toBe(500);
- expect(r.rect.bottom).toBe(300);
- expect(r.rect.top).toBe(380);
- expect(r.originX).toBe(400);
- expect(r.originY).toBe(300);
- });
-
- it('places origin at top-right with pivot (1, 1)', () => {
- const r = computeUIRectLayout(
- { x: 0.5, y: 0.5 },
- { x: 0.5, y: 0.5 },
- noOffset(),
- noOffset(),
- { x: 100, y: 80 },
- PARENT,
- { x: 1, y: 1 },
- );
- // myLeft = 400 - 100 = 300, myRight = 400
- // myBottom = 300 - 80 = 220, myTop = 300
- expect(r.rect.left).toBe(300);
- expect(r.rect.right).toBe(400);
- expect(r.originX).toBe(400);
- expect(r.originY).toBe(300);
- });
-
- it('allows element to extend beyond parent with large size', () => {
- const r = computeUIRectLayout(
- { x: 0.5, y: 0.5 },
- { x: 0.5, y: 0.5 },
- noOffset(),
- noOffset(),
- { x: 1600, y: 1200 },
- PARENT,
- );
- expect(r.width).toBe(1600);
- expect(r.height).toBe(1200);
- expect(r.rect.left).toBe(-400);
- expect(r.rect.right).toBe(1200);
- });
-
- it('produces zero-size rect with size (0, 0)', () => {
- const r = computeUIRectLayout(
- { x: 0.5, y: 0.5 },
- { x: 0.5, y: 0.5 },
- noOffset(),
- noOffset(),
- { x: 0, y: 0 },
- PARENT,
- );
- expect(r.width).toBe(0);
- expect(r.height).toBe(0);
- expect(r.originX).toBe(400);
- expect(r.originY).toBe(300);
- expect(r.rect.left).toBe(400);
- expect(r.rect.right).toBe(400);
- });
- });
-
- describe('stretch anchor (anchorMin !== anchorMax)', () => {
- it('fills parent exactly with full stretch and zero offsets', () => {
- const r = computeUIRectLayout(
- { x: 0, y: 0 },
- { x: 1, y: 1 },
- noOffset(),
- noOffset(),
- { x: 0, y: 0 },
- PARENT,
- );
- expect(r.width).toBe(800);
- expect(r.height).toBe(600);
- expect(r.rect.left).toBe(0);
- expect(r.rect.right).toBe(800);
- expect(r.rect.bottom).toBe(0);
- expect(r.rect.top).toBe(600);
- expect(r.originX).toBe(400);
- expect(r.originY).toBe(300);
- });
-
- it('insets from parent edges with positive offsets', () => {
- const r = computeUIRectLayout(
- { x: 0, y: 0 },
- { x: 1, y: 1 },
- { x: 10, y: 20 },
- { x: -10, y: -20 },
- { x: 0, y: 0 },
- PARENT,
- );
- // myLeft = 0 + 10 = 10, myRight = 800 + (-10) = 790
- // myBottom = 0 + 20 = 20, myTop = 600 + (-20) = 580
- expect(r.rect.left).toBe(10);
- expect(r.rect.right).toBe(790);
- expect(r.rect.bottom).toBe(20);
- expect(r.rect.top).toBe(580);
- expect(r.width).toBe(780);
- expect(r.height).toBe(560);
- });
-
- it('extends beyond parent with negative offsetMin and positive offsetMax', () => {
- const r = computeUIRectLayout(
- { x: 0, y: 0 },
- { x: 1, y: 1 },
- { x: -10, y: -10 },
- { x: 10, y: 10 },
- { x: 0, y: 0 },
- PARENT,
- );
- expect(r.rect.left).toBe(-10);
- expect(r.rect.right).toBe(810);
- expect(r.rect.bottom).toBe(-10);
- expect(r.rect.top).toBe(610);
- expect(r.width).toBe(820);
- expect(r.height).toBe(620);
- });
-
- it('stretches horizontally only when Y anchors match', () => {
- const r = computeUIRectLayout(
- { x: 0, y: 0.5 },
- { x: 1, y: 0.5 },
- noOffset(),
- noOffset(),
- { x: 0, y: 80 },
- PARENT,
- );
- // X: stretch => myLeft=0, myRight=800
- // Y: point => myBottom = 300 - 40 = 260, myTop = 340
- expect(r.width).toBe(800);
- expect(r.height).toBe(80);
- expect(r.rect.left).toBe(0);
- expect(r.rect.right).toBe(800);
- expect(r.rect.bottom).toBe(260);
- expect(r.rect.top).toBe(340);
- });
-
- it('stretches vertically only when X anchors match', () => {
- const r = computeUIRectLayout(
- { x: 0.5, y: 0 },
- { x: 0.5, y: 1 },
- noOffset(),
- noOffset(),
- { x: 100, y: 0 },
- PARENT,
- );
- // X: point => myLeft = 400 - 50 = 350, myRight = 450
- // Y: stretch => myBottom=0, myTop=600
- expect(r.width).toBe(100);
- expect(r.height).toBe(600);
- expect(r.rect.left).toBe(350);
- expect(r.rect.right).toBe(450);
- expect(r.rect.bottom).toBe(0);
- expect(r.rect.top).toBe(600);
- });
-
- it('computes partial stretch proportionally', () => {
- const r = computeUIRectLayout(
- { x: 0.25, y: 0.25 },
- { x: 0.75, y: 0.75 },
- noOffset(),
- noOffset(),
- { x: 0, y: 0 },
- PARENT,
- );
- // aLeft=200, aRight=600, aBottom=150, aTop=450
- expect(r.rect.left).toBe(200);
- expect(r.rect.right).toBe(600);
- expect(r.rect.bottom).toBe(150);
- expect(r.rect.top).toBe(450);
- expect(r.width).toBe(400);
- expect(r.height).toBe(300);
- expect(r.originX).toBe(400);
- expect(r.originY).toBe(300);
- });
-
- it('applies margins via offsets with stretch', () => {
- const r = computeUIRectLayout(
- { x: 0, y: 0 },
- { x: 1, y: 1 },
- { x: 50, y: 30 },
- { x: -50, y: -30 },
- { x: 0, y: 0 },
- PARENT,
- );
- expect(r.rect.left).toBe(50);
- expect(r.rect.right).toBe(750);
- expect(r.rect.bottom).toBe(30);
- expect(r.rect.top).toBe(570);
- expect(r.width).toBe(700);
- expect(r.height).toBe(540);
- });
-
- it('uses pivot for origin calculation in stretch mode', () => {
- const r = computeUIRectLayout(
- { x: 0, y: 0 },
- { x: 1, y: 1 },
- noOffset(),
- noOffset(),
- { x: 0, y: 0 },
- PARENT,
- { x: 0, y: 0 },
- );
- expect(r.originX).toBe(0);
- expect(r.originY).toBe(0);
- });
- });
-
- describe('edge cases', () => {
- it('returns zero-size result for zero-size parent', () => {
- const zeroParent: LayoutRect = { left: 0, bottom: 0, right: 0, top: 0 };
- const r = computeUIRectLayout(
- { x: 0, y: 0 },
- { x: 1, y: 1 },
- noOffset(),
- noOffset(),
- { x: 0, y: 0 },
- zeroParent,
- );
- expect(r.width).toBe(0);
- expect(r.height).toBe(0);
- expect(r.originX).toBe(0);
- expect(r.originY).toBe(0);
- });
-
- it('clamps negative width/height to zero', () => {
- // Stretch with offsets that invert left/right
- const r = computeUIRectLayout(
- { x: 0, y: 0 },
- { x: 1, y: 1 },
- { x: 500, y: 400 },
- { x: -500, y: -400 },
- { x: 0, y: 0 },
- PARENT,
- );
- // myLeft = 500, myRight = 800-500 = 300 => inverted
- // myBottom = 400, myTop = 600-400 = 200 => inverted
- expect(r.width).toBe(0);
- expect(r.height).toBe(0);
- });
-
- it('handles inverted anchors (anchorMin > anchorMax)', () => {
- const r = computeUIRectLayout(
- { x: 0.75, y: 0.75 },
- { x: 0.25, y: 0.25 },
- noOffset(),
- noOffset(),
- { x: 0, y: 0 },
- PARENT,
- );
- // aLeft = 600, aRight = 200 => myLeft=600, myRight=200 => width clamped to 0
- expect(r.width).toBe(0);
- expect(r.height).toBe(0);
- });
-
- it('handles pivot at extremes (0 and 1) in point mode', () => {
- const r0 = computeUIRectLayout(
- { x: 0.5, y: 0.5 },
- { x: 0.5, y: 0.5 },
- noOffset(),
- noOffset(),
- { x: 200, y: 100 },
- PARENT,
- { x: 0, y: 1 },
- );
- // X: myLeft = 400 - 200*0 = 400, myRight = 600
- // Y: myBottom = 300 - 100*1 = 200, myTop = 300
- expect(r0.rect.left).toBe(400);
- expect(r0.rect.right).toBe(600);
- expect(r0.rect.bottom).toBe(200);
- expect(r0.rect.top).toBe(300);
- expect(r0.originX).toBe(400);
- expect(r0.originY).toBe(300);
- });
-
- it('works with parent rect not starting at origin', () => {
- const offsetParent: LayoutRect = { left: 100, bottom: 50, right: 500, top: 350 };
- const r = computeUIRectLayout(
- { x: 0.5, y: 0.5 },
- { x: 0.5, y: 0.5 },
- noOffset(),
- noOffset(),
- { x: 100, y: 80 },
- offsetParent,
- );
- // parentW = 400, parentH = 300
- // aLeft = 100 + 0.5*400 = 300
- // aBottom = 50 + 0.5*300 = 200
- // myLeft = 300 - 50 = 250, myRight = 350
- // myBottom = 200 - 40 = 160, myTop = 240
- expect(r.originX).toBe(300);
- expect(r.originY).toBe(200);
- expect(r.rect.left).toBe(250);
- expect(r.rect.right).toBe(350);
- expect(r.rect.bottom).toBe(160);
- expect(r.rect.top).toBe(240);
- });
- });
-
- describe('nested layout', () => {
- it('child fills parent when using full stretch', () => {
- const parent = computeUIRectLayout(
- { x: 0, y: 0 },
- { x: 1, y: 1 },
- noOffset(),
- noOffset(),
- { x: 0, y: 0 },
- PARENT,
- );
- const child = computeUIRectLayout(
- { x: 0, y: 0 },
- { x: 1, y: 1 },
- noOffset(),
- noOffset(),
- { x: 0, y: 0 },
- parent.rect,
- );
- expect(child.rect).toEqual(parent.rect);
- expect(child.width).toBe(parent.width);
- expect(child.height).toBe(parent.height);
- });
-
- it('centers child at half parent size', () => {
- const parent = computeUIRectLayout(
- { x: 0, y: 0 },
- { x: 1, y: 1 },
- noOffset(),
- noOffset(),
- { x: 0, y: 0 },
- PARENT,
- );
- const child = computeUIRectLayout(
- { x: 0.5, y: 0.5 },
- { x: 0.5, y: 0.5 },
- noOffset(),
- noOffset(),
- { x: 400, y: 300 },
- parent.rect,
- );
- expect(child.width).toBe(400);
- expect(child.height).toBe(300);
- expect(child.originX).toBe(400);
- expect(child.originY).toBe(300);
- expect(child.rect.left).toBe(200);
- expect(child.rect.right).toBe(600);
- expect(child.rect.bottom).toBe(150);
- expect(child.rect.top).toBe(450);
- });
-
- it('chains layout results through multiple nesting levels', () => {
- const level1 = computeUIRectLayout(
- { x: 0, y: 0 },
- { x: 1, y: 1 },
- { x: 20, y: 20 },
- { x: -20, y: -20 },
- { x: 0, y: 0 },
- PARENT,
- );
- // level1: left=20, right=780, bottom=20, top=580 => 760x560
- expect(level1.width).toBe(760);
- expect(level1.height).toBe(560);
-
- const level2 = computeUIRectLayout(
- { x: 0, y: 0 },
- { x: 1, y: 1 },
- { x: 10, y: 10 },
- { x: -10, y: -10 },
- { x: 0, y: 0 },
- level1.rect,
- );
- // level2: left=30, right=770, bottom=30, top=570 => 740x540
- expect(level2.width).toBe(740);
- expect(level2.height).toBe(540);
- expect(level2.rect.left).toBe(30);
- expect(level2.rect.right).toBe(770);
- });
-
- it('produces consistent results across three nesting levels', () => {
- const l1 = computeUIRectLayout(
- { x: 0.25, y: 0.25 },
- { x: 0.75, y: 0.75 },
- noOffset(),
- noOffset(),
- { x: 0, y: 0 },
- PARENT,
- );
- // l1: 200..600 x 150..450 => 400x300
- const l2 = computeUIRectLayout(
- { x: 0.25, y: 0.25 },
- { x: 0.75, y: 0.75 },
- noOffset(),
- noOffset(),
- { x: 0, y: 0 },
- l1.rect,
- );
- // l2 parentW=400, parentH=300
- // aLeft=200+0.25*400=300, aRight=200+0.75*400=500
- // aBottom=150+0.25*300=225, aTop=150+0.75*300=375
- // => 300..500 x 225..375 => 200x150
- expect(l2.width).toBe(200);
- expect(l2.height).toBe(150);
-
- const l3 = computeUIRectLayout(
- { x: 0.25, y: 0.25 },
- { x: 0.75, y: 0.75 },
- noOffset(),
- noOffset(),
- { x: 0, y: 0 },
- l2.rect,
- );
- // l3 parentW=200, parentH=150
- // => 100x75
- expect(l3.width).toBe(100);
- expect(l3.height).toBe(75);
- expect(l3.originX).toBe(400);
- expect(l3.originY).toBe(300);
- });
- });
-});
diff --git a/src/esengine/animation/TweenSystem.cpp b/src/esengine/animation/TweenSystem.cpp
index 5c10c6fad..efe0df220 100644
--- a/src/esengine/animation/TweenSystem.cpp
+++ b/src/esengine/animation/TweenSystem.cpp
@@ -5,7 +5,6 @@
#include "../ecs/components/Transform.hpp"
#include "../ecs/components/Sprite.hpp"
#include "../ecs/components/Camera.hpp"
-#include "../ecs/components/UIRect.hpp"
#include "../ecs/components/UINode.hpp"
#include <glm/glm.hpp>
@@ -131,13 +130,12 @@ void TweenSystem::resumeTween(ecs::Registry& registry, Entity tweenEntity) {
// Tween owns the writes for its fixed 13 targets (was routed through the generic
// animTargets `applyAnimatedValue`; REARCH_ANIMATION P4b decouples it so the
// generic enum+switch can be deleted with the C++ timeline in P4c). Mirrors the
-// per-field semantics exactly: rotation.z → half-angle quaternion, and the UIRect
+// per-field semantics exactly: rotation.z → half-angle quaternion, and the UINode
// `anim_override_` flags so UI layout doesn't clobber animated Transform fields.
-// Flag the entity's layout component (modern UINode or legacy UIRect) so the
-// layout pass leaves the tween-driven Transform field alone this frame.
+// Flag the entity's UINode so the layout pass leaves the tween-driven Transform
+// field alone this frame.
static void markUIAnimOverride(ecs::Registry& registry, Entity entity, u8 flag) {
if (auto* n = registry.tryGet<ecs::UINode>(entity)) n->anim_override_ |= flag;
- else if (auto* r = registry.tryGet<ecs::UIRect>(entity)) r->anim_override_ |= flag;
}
static void applyTweenValue(ecs::Registry& registry, Entity entity, TweenTarget target, f32 value) {
diff --git a/src/esengine/bindings/EditorAPI.generated.cpp b/src/esengine/bindings/EditorAPI.generated.cpp
index c430ff21f..30ef0eb6c 100644
--- a/src/esengine/bindings/EditorAPI.generated.cpp
+++ b/src/esengine/bindings/EditorAPI.generated.cpp
@@ -2,10 +2,10 @@
* @file EditorAPI.generated.cpp
* @brief Auto-generated editor API with string-dispatched component access
* @details Generated by EHT - DO NOT EDIT
- * @schema_hash 7084ff0da3e21818
+ * @schema_hash 4f7df7328b5a8159
*/
-#define ES_EDITOR_API_SCHEMA_HASH "7084ff0da3e21818"
+#define ES_EDITOR_API_SCHEMA_HASH "4f7df7328b5a8159"
#include <emscripten/bind.h>
#include <string>
@@ -32,7 +32,6 @@
#include "../ecs/components/UIInteraction.hpp"
#include "../ecs/components/UIMask.hpp"
#include "../ecs/components/UINode.hpp"
-#include "../ecs/components/UIRect.hpp"
#include "../ecs/components/UIRenderer.hpp"
#include "../ecs/components/Velocity.hpp"
#include <glm/gtc/quaternion.hpp>
@@ -79,7 +78,6 @@ std::vector<std::string> editor_getComponentNames() {
"UIInteraction",
"UIMask",
"UINode",
- "UIRect",
"UIRenderer",
"Velocity",
};
@@ -507,21 +505,6 @@ std::string editor_getComponentSchema(const std::string& name) {
{"key":"insetBottom.value","type":"float","group":"UINode"},
{"key":"insetBottom.unit","type":"float","group":"UINode"}
])JSON";
- } else if (name == "UIRect") {
- return R"JSON([
- {"key":"anchorMin.x","type":"float","group":"UIRect"},
- {"key":"anchorMin.y","type":"float","group":"UIRect"},
- {"key":"anchorMax.x","type":"float","group":"UIRect"},
- {"key":"anchorMax.y","type":"float","group":"UIRect"},
- {"key":"offsetMin.x","type":"float","group":"UIRect"},
- {"key":"offsetMin.y","type":"float","group":"UIRect"},
- {"key":"offsetMax.x","type":"float","group":"UIRect"},
- {"key":"offsetMax.y","type":"float","group":"UIRect"},
- {"key":"size.x","type":"float","group":"UIRect"},
- {"key":"size.y","type":"float","group":"UIRect"},
- {"key":"pivot.x","type":"float","group":"UIRect"},
- {"key":"pivot.y","type":"float","group":"UIRect"}
- ])JSON";
} else if (name == "UIRenderer") {
return R"JSON([
{"key":"visualType","type":"enum","group":"UIRenderer","values":["None","SolidColor","Image","NineSlice"]},
@@ -634,9 +617,6 @@ bool editor_addComponent(Registry& reg, u32 e, const std::string& name) {
} else if (name == "UINode") {
if (!reg.has<esengine::ecs::UINode>(entity)) reg.emplace<esengine::ecs::UINode>(entity);
return true;
- } else if (name == "UIRect") {
- if (!reg.has<esengine::ecs::UIRect>(entity)) reg.emplace<esengine::ecs::UIRect>(entity);
- return true;
} else if (name == "UIRenderer") {
if (!reg.has<esengine::ecs::UIRenderer>(entity)) reg.emplace<esengine::ecs::UIRenderer>(entity);
return true;
@@ -700,8 +680,6 @@ bool editor_removeComponent(Registry& reg, u32 e, const std::string& name) {
if (reg.has<esengine::ecs::UIMask>(entity)) { reg.remove<esengine::ecs::UIMask>(entity); return true; }
} else if (name == "UINode") {
if (reg.has<esengine::ecs::UINode>(entity)) { reg.remove<esengine::ecs::UINode>(entity); return true; }
- } else if (name == "UIRect") {
- if (reg.has<esengine::ecs::UIRect>(entity)) { reg.remove<esengine::ecs::UIRect>(entity); return true; }
} else if (name == "UIRenderer") {
if (reg.has<esengine::ecs::UIRenderer>(entity)) { reg.remove<esengine::ecs::UIRenderer>(entity); return true; }
} else if (name == "Velocity") {
@@ -738,7 +716,6 @@ bool editor_hasComponent(Registry& reg, u32 e, const std::string& name) {
if (name == "UIInteraction") return reg.has<esengine::ecs::UIInteraction>(entity);
if (name == "UIMask") return reg.has<esengine::ecs::UIMask>(entity);
if (name == "UINode") return reg.has<esengine::ecs::UINode>(entity);
- if (name == "UIRect") return reg.has<esengine::ecs::UIRect>(entity);
if (name == "UIRenderer") return reg.has<esengine::ecs::UIRenderer>(entity);
if (name == "Velocity") return reg.has<esengine::ecs::Velocity>(entity);
return false;
@@ -775,7 +752,6 @@ std::vector<std::string> editor_getComponents(Registry& reg, u32 e) {
if (reg.has<esengine::ecs::UIInteraction>(entity)) result.push_back("UIInteraction");
if (reg.has<esengine::ecs::UIMask>(entity)) result.push_back("UIMask");
if (reg.has<esengine::ecs::UINode>(entity)) result.push_back("UINode");
- if (reg.has<esengine::ecs::UIRect>(entity)) result.push_back("UIRect");
if (reg.has<esengine::ecs::UIRenderer>(entity)) result.push_back("UIRenderer");
if (reg.has<esengine::ecs::Velocity>(entity)) result.push_back("Velocity");
return result;
@@ -1122,23 +1098,6 @@ bool editor_setFloat(Registry& reg, u32 e, const std::string& comp, const std::s
else if (field == "insetBottom.unit") { c.insetBottom.unit = value; }
else { return false; }
return true;
- } else if (comp == "UIRect") {
- if (!reg.has<esengine::ecs::UIRect>(entity)) return false;
- auto& c = reg.get<esengine::ecs::UIRect>(entity);
- if (field == "anchorMin.x") { c.anchorMin.x = value; }
- else if (field == "anchorMin.y") { c.anchorMin.y = value; }
- else if (field == "anchorMax.x") { c.anchorMax.x = value; }
- else if (field == "anchorMax.y") { c.anchorMax.y = value; }
- else if (field == "offsetMin.x") { c.offsetMin.x = value; }
- else if (field == "offsetMin.y") { c.offsetMin.y = value; }
- else if (field == "offsetMax.x") { c.offsetMax.x = value; }
- else if (field == "offsetMax.y") { c.offsetMax.y = value; }
- else if (field == "size.x") { c.size.x = value; }
- else if (field == "size.y") { c.size.y = value; }
- else if (field == "pivot.x") { c.pivot.x = value; }
- else if (field == "pivot.y") { c.pivot.y = value; }
- else { return false; }
- return true;
} else if (comp == "UIRenderer") {
if (!reg.has<esengine::ecs::UIRenderer>(entity)) return false;
auto& c = reg.get<esengine::ecs::UIRenderer>(entity);
@@ -1462,21 +1421,6 @@ f32 editor_getFloat(Registry& reg, u32 e, const std::string& comp, const std::st
else if (field == "insetRight.unit") { return c.insetRight.unit; }
else if (field == "insetBottom.value") { return c.insetBottom.value; }
else if (field == "insetBottom.unit") { return c.insetBottom.unit; }
- } else if (comp == "UIRect") {
- if (!reg.has<esengine::ecs::UIRect>(entity)) return 0.0f;
- const auto& c = reg.get<esengine::ecs::UIRect>(entity);
- if (field == "anchorMin.x") { return c.anchorMin.x; }
- else if (field == "anchorMin.y") { return c.anchorMin.y; }
- else if (field == "anchorMax.x") { return c.anchorMax.x; }
- else if (field == "anchorMax.y") { return c.anchorMax.y; }
- else if (field == "offsetMin.x") { return c.offsetMin.x; }
- else if (field == "offsetMin.y") { return c.offsetMin.y; }
- else if (field == "offsetMax.x") { return c.offsetMax.x; }
- else if (field == "offsetMax.y") { return c.offsetMax.y; }
- else if (field == "size.x") { return c.size.x; }
- else if (field == "size.y") { return c.size.y; }
- else if (field == "pivot.x") { return c.pivot.x; }
- else if (field == "pivot.y") { return c.pivot.y; }
} else if (comp == "UIRenderer") {
if (!reg.has<esengine::ecs::UIRenderer>(entity)) return 0.0f;
const auto& c = reg.get<esengine::ecs::UIRenderer>(entity);
diff --git a/src/esengine/bindings/WebBindings.generated.cpp b/src/esengine/bindings/WebBindings.generated.cpp
index ac98b3c39..0129ec4a6 100644
--- a/src/esengine/bindings/WebBindings.generated.cpp
+++ b/src/esengine/bindings/WebBindings.generated.cpp
@@ -32,7 +32,6 @@
#include "../ecs/components/UIInteraction.hpp"
#include "../ecs/components/UIMask.hpp"
#include "../ecs/components/UINode.hpp"
-#include "../ecs/components/UIRect.hpp"
#include "../ecs/components/UIRenderer.hpp"
#include "../ecs/components/Velocity.hpp"
@@ -1245,14 +1244,6 @@ EMSCRIPTEN_BINDINGS(esengine_components) {
.field("insetRight", &UINodeJS::insetRight)
.field("insetBottom", &UINodeJS::insetBottom);
- value_object<esengine::ecs::UIRect>("UIRect")
- .field("anchorMin", &esengine::ecs::UIRect::anchorMin)
- .field("anchorMax", &esengine::ecs::UIRect::anchorMax)
- .field("offsetMin", &esengine::ecs::UIRect::offsetMin)
- .field("offsetMax", &esengine::ecs::UIRect::offsetMax)
- .field("size", &esengine::ecs::UIRect::size)
- .field("pivot", &esengine::ecs::UIRect::pivot);
-
value_object<UIRendererJS>("UIRenderer")
.field("visualType", &UIRendererJS::visualType)
.field("texture", &UIRendererJS::texture)
@@ -1799,27 +1790,6 @@ EMSCRIPTEN_BINDINGS(esengine_registry) {
r.remove<esengine::ecs::UINode>(entity);
}))
- // UIRect
- .function("hasUIRect", optional_override([](Registry& r, u32 e) {
- return r.has<esengine::ecs::UIRect>(static_cast<Entity>(e));
- }))
- .function("getUIRect", optional_override([](Registry& r, u32 e) -> esengine::ecs::UIRect& {
- auto entity = static_cast<Entity>(e);
- static esengine::ecs::UIRect s_dummy{};
- if (!r.valid(entity) || !r.has<esengine::ecs::UIRect>(entity)) return s_dummy;
- return r.get<esengine::ecs::UIRect>(entity);
- }), allow_raw_pointers())
- .function("addUIRect", optional_override([](Registry& r, u32 e, const esengine::ecs::UIRect& c) {
- auto entity = static_cast<Entity>(e);
- if (!r.valid(entity)) return;
- r.emplaceOrReplace<esengine::ecs::UIRect>(entity, c);
- }))
- .function("removeUIRect", optional_override([](Registry& r, u32 e) {
- auto entity = static_cast<Entity>(e);
- if (!r.valid(entity) || !r.has<esengine::ecs::UIRect>(entity)) return;
- r.remove<esengine::ecs::UIRect>(entity);
- }))
-
// UIRenderer
.function("hasUIRenderer", optional_override([](Registry& r, u32 e) {
return r.has<esengine::ecs::UIRenderer>(static_cast<Entity>(e));
@@ -1902,7 +1872,6 @@ emscripten::val esengineGetBuiltinComponentNames() {
arr.set(i++, val(std::string("UIInteraction")));
arr.set(i++, val(std::string("UIMask")));
arr.set(i++, val(std::string("UINode")));
- arr.set(i++, val(std::string("UIRect")));
arr.set(i++, val(std::string("UIRenderer")));
arr.set(i++, val(std::string("Velocity")));
return arr;
@@ -2105,12 +2074,6 @@ static_assert(offsetof(esengine::ecs::UINode, position) == 0, "ABI offset drift:
static_assert(offsetof(esengine::ecs::UINode, flexGrow) == 52, "ABI offset drift: esengine::ecs::UINode.flexGrow (EHT expected 52)");
static_assert(offsetof(esengine::ecs::UINode, flexShrink) == 56, "ABI offset drift: esengine::ecs::UINode.flexShrink (EHT expected 56)");
static_assert(offsetof(esengine::ecs::UINode, alignSelf) == 68, "ABI offset drift: esengine::ecs::UINode.alignSelf (EHT expected 68)");
-static_assert(offsetof(esengine::ecs::UIRect, anchorMin) == 0, "ABI offset drift: esengine::ecs::UIRect.anchorMin (EHT expected 0)");
-static_assert(offsetof(esengine::ecs::UIRect, anchorMax) == 8, "ABI offset drift: esengine::ecs::UIRect.anchorMax (EHT expected 8)");
-static_assert(offsetof(esengine::ecs::UIRect, offsetMin) == 16, "ABI offset drift: esengine::ecs::UIRect.offsetMin (EHT expected 16)");
-static_assert(offsetof(esengine::ecs::UIRect, offsetMax) == 24, "ABI offset drift: esengine::ecs::UIRect.offsetMax (EHT expected 24)");
-static_assert(offsetof(esengine::ecs::UIRect, size) == 32, "ABI offset drift: esengine::ecs::UIRect.size (EHT expected 32)");
-static_assert(offsetof(esengine::ecs::UIRect, pivot) == 40, "ABI offset drift: esengine::ecs::UIRect.pivot (EHT expected 40)");
static_assert(offsetof(esengine::ecs::UIRenderer, visualType) == 0, "ABI offset drift: esengine::ecs::UIRenderer.visualType (EHT expected 0)");
static_assert(offsetof(esengine::ecs::UIRenderer, texture) == 4, "ABI offset drift: esengine::ecs::UIRenderer.texture (EHT expected 4)");
static_assert(offsetof(esengine::ecs::UIRenderer, color) == 8, "ABI offset drift: esengine::ecs::UIRenderer.color (EHT expected 8)");
@@ -2127,7 +2090,7 @@ static_assert(offsetof(esengine::ecs::Velocity, angular) == 12, "ABI offset drif
// ABI Hash -- runtime handshake against the SDK bundle
// =============================================================================
-static const char* kEsAbiLayoutHash = "dba3504ff7b44cfd";
+static const char* kEsAbiLayoutHash = "b20732a9b17a5058";
std::string esengineGetAbiLayoutHash() {
return std::string(kEsAbiLayoutHash);
diff --git a/src/esengine/bindings/WebSDKEntry.cpp b/src/esengine/bindings/WebSDKEntry.cpp
index 6fece573b..9c93d9c59 100644
--- a/src/esengine/bindings/WebSDKEntry.cpp
+++ b/src/esengine/bindings/WebSDKEntry.cpp
@@ -43,7 +43,6 @@
#include "../core/World.hpp"
#include "../ecs/components/Velocity.hpp"
#include "../ecs/components/Camera.hpp"
-#include "../ecs/components/UIRect.hpp"
#include "../ecs/components/UINode.hpp"
#include "../ecs/components/UIRenderer.hpp"
#include "../ecs/components/RigidBody.hpp"
@@ -290,12 +289,6 @@ int getCameraPtr(ecs::Registry& r, u32 e) {
return static_cast<int>(reinterpret_cast<uintptr_t>(c));
}
-int getUIRectPtr(ecs::Registry& r, u32 e) {
- auto* rect = r.tryGet<ecs::UIRect>(Entity::fromRaw(e));
- if (!rect) return 0;
- return static_cast<int>(reinterpret_cast<uintptr_t>(rect));
-}
-
int getRigidBodyPtr(ecs::Registry& r, u32 e) {
auto* rb = r.tryGet<ecs::RigidBody>(Entity::fromRaw(e));
if (!rb) return 0;
@@ -321,7 +314,6 @@ EMSCRIPTEN_BINDINGS(esengine_ptr_access) {
emscripten::function("getSpritePtr", &esengine::getSpritePtr);
emscripten::function("getVelocityPtr", &esengine::getVelocityPtr);
emscripten::function("getCameraPtr", &esengine::getCameraPtr);
- emscripten::function("getUIRectPtr", &esengine::getUIRectPtr);
emscripten::function("getRigidBodyPtr", &esengine::getRigidBodyPtr);
emscripten::function("getBoxColliderPtr", &esengine::getBoxColliderPtr);
emscripten::function("getCircleColliderPtr", &esengine::getCircleColliderPtr);
@@ -582,20 +574,8 @@ void uiTree_markAllDirty() {
ctx().require<ecs::UISystem>().tree.markAllDirty();
}
-f32 getUIRectComputedWidth(ecs::Registry& registry, u32 entity) {
- auto* rect = registry.tryGet<ecs::UIRect>(Entity::fromRaw(entity));
- if (!rect) return 0.0f;
- return rect->computed_size_.x;
-}
-
-f32 getUIRectComputedHeight(ecs::Registry& registry, u32 entity) {
- auto* rect = registry.tryGet<ecs::UIRect>(Entity::fromRaw(entity));
- if (!rect) return 0.0f;
- return rect->computed_size_.y;
-}
-
-// UINode (CSS box, REARCH_GUI F3) computed size — its internal computed_size_ is
-// not embind-readable, so expose it the same way as UIRect for TS uiHelpers.
+// UINode (CSS box) computed size — its internal computed_size_ is not
+// embind-readable, so expose it for TS uiHelpers.
f32 getUINodeComputedWidth(ecs::Registry& registry, u32 entity) {
auto* node = registry.tryGet<ecs::UINode>(Entity::fromRaw(entity));
if (!node) return 0.0f;
@@ -608,14 +588,6 @@ f32 getUINodeComputedHeight(ecs::Registry& registry, u32 entity) {
return node->computed_size_.y;
}
-void setUIRectSize(ecs::Registry& registry, u32 entity, f32 w, f32 h) {
- auto* rect = registry.tryGet<ecs::UIRect>(Entity::fromRaw(entity));
- if (!rect) return;
- rect->size.x = w;
- rect->size.y = h;
- ctx().require<ecs::UISystem>().treeMarkDirty(Entity::fromRaw(entity));
-}
-
void transform_update(ecs::Registry& registry) {
esengine::World world{registry, ctx().services(), 0.0f};
if (auto* ts = ctx().tryGet<ecs::TransformSystem>()) {
@@ -626,10 +598,9 @@ void transform_update(ecs::Registry& registry) {
}
}
+// Per-frame clear of UINode tween anim-override flags (set by the tween system,
+// read by the layout pass). Name kept (ui_*) for the TS binding.
void uiRect_clearAnimOverrides(ecs::Registry& registry) {
- for (auto entity : registry.view<ecs::UIRect>()) {
- registry.get<ecs::UIRect>(entity).anim_override_ = 0;
- }
for (auto entity : registry.view<ecs::UINode>()) {
registry.get<ecs::UINode>(entity).anim_override_ = 0;
}
@@ -638,19 +609,9 @@ void uiRect_clearAnimOverrides(ecs::Registry& registry) {
void uiRect_setAnimOverride(ecs::Registry& registry, u32 entity, u8 flags) {
if (auto* n = registry.tryGet<ecs::UINode>(Entity::fromRaw(entity))) {
n->anim_override_ |= flags;
- } else if (auto* rect = registry.tryGet<ecs::UIRect>(Entity::fromRaw(entity))) {
- rect->anim_override_ |= flags;
}
}
-void uiRect_patchOffset(ecs::Registry& registry, u32 entity,
- f32 minX, f32 minY, f32 maxX, f32 maxY) {
- auto* rect = registry.tryGet<ecs::UIRect>(Entity::fromRaw(entity));
- if (!rect) return;
- rect->offsetMin = {minX, minY};
- rect->offsetMax = {maxX, maxY};
-}
-
void transform_patchPosition(ecs::Registry& registry, u32 entity,
f32 x, f32 y, f32 z) {
auto* transform = registry.tryGet<ecs::Transform>(Entity::fromRaw(entity));
@@ -668,18 +629,14 @@ EMSCRIPTEN_BINDINGS(esengine_ui_systems) {
emscripten::function("uiRenderOrder_update", &esengine::uiRenderOrder_update);
emscripten::function("ui_getRenderOrder", &esengine::ui_getRenderOrder);
emscripten::function("uiFlexLayout_update", &esengine::uiFlexLayout_update);
- emscripten::function("getUIRectComputedWidth", &esengine::getUIRectComputedWidth);
- emscripten::function("getUIRectComputedHeight", &esengine::getUIRectComputedHeight);
emscripten::function("getUINodeComputedWidth", &esengine::getUINodeComputedWidth);
emscripten::function("getUINodeComputedHeight", &esengine::getUINodeComputedHeight);
emscripten::function("uiTree_markStructureDirty", &esengine::uiTree_markStructureDirty);
emscripten::function("uiTree_markDirty", &esengine::uiTree_markDirty);
emscripten::function("uiTree_markAllDirty", &esengine::uiTree_markAllDirty);
- emscripten::function("setUIRectSize", &esengine::setUIRectSize);
emscripten::function("transform_update", &esengine::transform_update);
emscripten::function("uiRect_clearAnimOverrides", &esengine::uiRect_clearAnimOverrides);
emscripten::function("uiRect_setAnimOverride", &esengine::uiRect_setAnimOverride);
- emscripten::function("uiRect_patchOffset", &esengine::uiRect_patchOffset);
emscripten::function("transform_patchPosition", &esengine::transform_patchPosition);
}
diff --git a/src/esengine/core/Reflection.hpp b/src/esengine/core/Reflection.hpp
index c6d39b13a..26ff1a6b2 100644
--- a/src/esengine/core/Reflection.hpp
+++ b/src/esengine/core/Reflection.hpp
@@ -47,7 +47,7 @@
* - asset=<type> : marks field as asset reference (texture, material, font, audio, etc.)
* - animatable : marks field as animatable via timeline
* - entity_ref : marks field as entity reference (for ID remapping)
- * - anim_flag=<flag> : animation side-effect flag (e.g. ANIM_POS_X on UIRect)
+ * - anim_flag=<flag> : animation side-effect flag (e.g. ANIM_POS_X on UINode)
*
* Examples:
* ES_PROPERTY(asset=texture)
diff --git a/src/esengine/ecs/UIHitTestSystem.hpp b/src/esengine/ecs/UIHitTestSystem.hpp
index f583306a3..7621c0b1f 100644
--- a/src/esengine/ecs/UIHitTestSystem.hpp
+++ b/src/esengine/ecs/UIHitTestSystem.hpp
@@ -11,7 +11,6 @@
#include "Registry.hpp"
#include "components/Transform.hpp"
#include "components/Hierarchy.hpp"
-#include "components/UIRect.hpp"
#include "components/UINode.hpp"
#include "components/UIMask.hpp"
@@ -61,30 +60,19 @@ inline bool isClippedByMask(
auto* mask = registry.tryGet<UIMask>(ancestor);
if (mask && mask->enabled) {
auto* t = registry.tryGet<Transform>(ancestor);
- if (t) {
- // Mask geometry from the modern UINode (pivot-centered) or UIRect.
- f32 baseW = 0.0f, baseH = 0.0f, pivotX = 0.5f, pivotY = 0.5f;
- bool haveBox = false;
- if (auto* node = registry.tryGet<UINode>(ancestor)) {
- baseW = node->computed_size_.x; baseH = node->computed_size_.y;
- haveBox = true;
- } else if (auto* rect = registry.tryGet<UIRect>(ancestor)) {
- baseW = rect->computed_size_.x > 0.0f ? rect->computed_size_.x : rect->size.x;
- baseH = rect->computed_size_.y > 0.0f ? rect->computed_size_.y : rect->size.y;
- pivotX = rect->pivot.x; pivotY = rect->pivot.y;
- haveBox = true;
- }
- if (haveBox) {
- t->ensureDecomposed();
- if (!pointInOBB(
- worldMouseX, worldMouseY,
- t->worldPosition.x, t->worldPosition.y,
- baseW * t->worldScale.x, baseH * t->worldScale.y,
- pivotX, pivotY,
- t->worldRotation.z, t->worldRotation.w
- )) {
- return true;
- }
+ auto* node = registry.tryGet<UINode>(ancestor);
+ if (t && node) {
+ t->ensureDecomposed();
+ // UINode mask box is pivot-centered.
+ if (!pointInOBB(
+ worldMouseX, worldMouseY,
+ t->worldPosition.x, t->worldPosition.y,
+ node->computed_size_.x * t->worldScale.x,
+ node->computed_size_.y * t->worldScale.y,
+ 0.5f, 0.5f,
+ t->worldRotation.z, t->worldRotation.w
+ )) {
+ return true;
}
}
}
diff --git a/src/esengine/ecs/UILayoutSystem.cpp b/src/esengine/ecs/UILayoutSystem.cpp
index 492a55a5d..891f34e32 100644
--- a/src/esengine/ecs/UILayoutSystem.cpp
+++ b/src/esengine/ecs/UILayoutSystem.cpp
@@ -4,132 +4,22 @@
#include "UISystem.hpp"
#include "components/Transform.hpp"
-#include "components/Sprite.hpp"
#include "components/Canvas.hpp"
#include "components/FlexContainer.hpp"
-#include "components/FlexItem.hpp"
-#include "components/GridLayout.hpp"
+#include "components/FlexItem.hpp" // AlignSelf
#include "components/UINode.hpp"
#include <yoga/Yoga.h>
-#include <algorithm>
-#include <cmath>
#include <unordered_map>
#include <vector>
namespace esengine::ecs {
-LayoutResult computeAnchorLayout(
- const glm::vec2& anchorMin, const glm::vec2& anchorMax,
- const glm::vec2& offsetMin, const glm::vec2& offsetMax,
- const glm::vec2& size, const LayoutRect& parentRect,
- const glm::vec2& pivot
-) {
- f32 parentW = parentRect.right - parentRect.left;
- f32 parentH = parentRect.top - parentRect.bottom;
-
- f32 aLeft = parentRect.left + anchorMin.x * parentW;
- f32 aRight = parentRect.left + anchorMax.x * parentW;
- f32 aBottom = parentRect.bottom + anchorMin.y * parentH;
- f32 aTop = parentRect.bottom + anchorMax.y * parentH;
-
- f32 myLeft, myBottom, myRight, myTop;
-
- if (anchorMin.x == anchorMax.x) {
- myLeft = aLeft + offsetMin.x - size.x * pivot.x;
- myRight = myLeft + size.x;
- } else {
- myLeft = aLeft + offsetMin.x;
- myRight = aRight + offsetMax.x;
- }
-
- if (anchorMin.y == anchorMax.y) {
- myBottom = aBottom + offsetMin.y - size.y * pivot.y;
- myTop = myBottom + size.y;
- } else {
- myBottom = aBottom + offsetMin.y;
- myTop = aTop + offsetMax.y;
- }
-
- f32 width = std::max(0.0f, myRight - myLeft);
- f32 height = std::max(0.0f, myTop - myBottom);
- f32 originX = myLeft + pivot.x * width;
- f32 originY = myBottom + pivot.y * height;
-
- return {
- originX,
- originY,
- { myLeft, myBottom, myLeft + width, myBottom + height },
- };
-}
-
namespace {
-LayoutRect getParentLayoutRect(
- Registry& registry,
- const UITree::Node& node,
- const LayoutRect& cameraRect
-) {
- if (node.parent == INVALID_ENTITY) {
- return cameraRect;
- }
- auto& parentRect = registry.get<UIRect>(node.parent);
- f32 pw = parentRect.computed_size_.x;
- f32 ph = parentRect.computed_size_.y;
- return { -pw * parentRect.pivot.x, -ph * parentRect.pivot.y,
- pw * (1.0f - parentRect.pivot.x), ph * (1.0f - parentRect.pivot.y) };
-}
-
-void setLayoutPosition(Transform& t, UIRect* rect, f32 x, f32 y) {
- if (rect && rect->anim_override_) {
- if (!(rect->anim_override_ & UIRect::ANIM_POS_X)) t.position.x = x;
- if (!(rect->anim_override_ & UIRect::ANIM_POS_Y)) t.position.y = y;
- } else {
- t.position.x = x;
- t.position.y = y;
- }
-}
-
-void writePosition(
- Registry& registry,
- const UITree::Node& node,
- f32 originX, f32 originY,
- const LayoutRect& cameraRect
-) {
- auto* transform = registry.tryGet<Transform>(node.entity);
- if (!transform) return;
- setLayoutPosition(*transform, registry.tryGet<UIRect>(node.entity), originX, originY);
-}
-
-void layoutNodeAnchor(
- Registry& registry,
- UITree::Node& node,
- const LayoutRect& cameraRect
-) {
- auto& rect = registry.get<UIRect>(node.entity);
- LayoutRect parentRect = getParentLayoutRect(registry, node, cameraRect);
-
- auto result = computeAnchorLayout(
- rect.anchorMin, rect.anchorMax,
- rect.offsetMin, rect.offsetMax,
- rect.size, parentRect, rect.pivot
- );
-
- f32 width = result.rect.right - result.rect.left;
- f32 height = result.rect.top - result.rect.bottom;
- rect.computed_size_.x = width;
- rect.computed_size_.y = height;
-
- auto* sprite = registry.tryGet<Sprite>(node.entity);
- if (sprite) {
- if (sprite->size.x != width || sprite->size.y != height) {
- sprite->size.x = width;
- sprite->size.y = height;
- }
- }
-
- writePosition(registry, node, result.origin_x, result.origin_y, cameraRect);
-}
+// =============================================================================
+// Flex enum → Yoga mappers (shared by the UINode container + item styling)
+// =============================================================================
YGFlexDirection toYGFlexDirection(FlexDirection dir) {
switch (dir) {
@@ -194,202 +84,15 @@ YGAlign toYGAlignSelf(AlignSelf as) {
return YGAlignAuto;
}
-struct FlexChildInfo {
- i32 tree_index;
- Entity entity;
-};
-
-void resolveFlexChildren(
- Registry& registry,
- UITree& tree,
- i32 containerIndex,
- const LayoutRect& cameraRect
-) {
- Entity containerEntity = tree.nodes_[containerIndex].entity;
- auto& flex = registry.get<FlexContainer>(containerEntity);
- auto& parentRect = registry.get<UIRect>(containerEntity);
-
- f32 parentW = parentRect.computed_size_.x;
- f32 parentH = parentRect.computed_size_.y;
- f32 pivotX = parentRect.pivot.x;
- f32 pivotY = parentRect.pivot.y;
-
- std::vector<FlexChildInfo> children;
- for (i32 j = containerIndex + 1; j < static_cast<i32>(tree.nodes_.size()); j++) {
- if (tree.nodes_[j].parent != containerEntity) continue;
- if (tree.nodes_[j].depth != tree.nodes_[containerIndex].depth + 1) continue;
- Entity childEntity = tree.nodes_[j].entity;
- if (!registry.has<UIRect>(childEntity)) continue;
- children.push_back({j, childEntity});
- }
-
- if (children.empty()) return;
-
- YGNodeRef root = YGNodeNew();
- YGNodeStyleSetFlexDirection(root, toYGFlexDirection(flex.direction));
- YGNodeStyleSetFlexWrap(root, toYGWrap(flex.wrap));
- YGNodeStyleSetJustifyContent(root, toYGJustify(flex.justifyContent));
- YGNodeStyleSetAlignItems(root, toYGAlign(flex.alignItems));
- YGNodeStyleSetWidth(root, parentW);
- YGNodeStyleSetHeight(root, parentH);
- YGNodeStyleSetPadding(root, YGEdgeLeft, flex.padding.left);
- YGNodeStyleSetPadding(root, YGEdgeTop, flex.padding.top);
- YGNodeStyleSetPadding(root, YGEdgeRight, flex.padding.right);
- YGNodeStyleSetPadding(root, YGEdgeBottom, flex.padding.bottom);
- YGNodeStyleSetAlignContent(root, toYGAlignContent(flex.alignContent));
- YGNodeStyleSetGap(root, YGGutterColumn, flex.gap.x);
- YGNodeStyleSetGap(root, YGGutterRow, flex.gap.y);
-
- std::vector<YGNodeRef> childNodes;
- childNodes.reserve(children.size());
-
- for (usize i = 0; i < children.size(); i++) {
- auto& childRect = registry.get<UIRect>(children[i].entity);
- f32 cw = childRect.computed_size_.x > 0.0f ? childRect.computed_size_.x : childRect.size.x;
- f32 ch = childRect.computed_size_.y > 0.0f ? childRect.computed_size_.y : childRect.size.y;
-
- YGNodeRef child = YGNodeNew();
-
- auto* fi = registry.tryGet<FlexItem>(children[i].entity);
- if (fi) {
- YGNodeStyleSetFlexGrow(child, fi->flexGrow);
- YGNodeStyleSetFlexShrink(child, fi->flexShrink);
- if (fi->flexBasis >= 0.0f) {
- YGNodeStyleSetFlexBasis(child, fi->flexBasis);
- } else {
- YGNodeStyleSetFlexBasisAuto(child);
- }
- YGNodeStyleSetAlignSelf(child, toYGAlignSelf(fi->alignSelf));
- YGNodeStyleSetMargin(child, YGEdgeLeft, fi->margin.left);
- YGNodeStyleSetMargin(child, YGEdgeTop, fi->margin.top);
- YGNodeStyleSetMargin(child, YGEdgeRight, fi->margin.right);
- YGNodeStyleSetMargin(child, YGEdgeBottom, fi->margin.bottom);
- if (fi->minWidth >= 0.0f) YGNodeStyleSetMinWidth(child, fi->minWidth);
- if (fi->minHeight >= 0.0f) YGNodeStyleSetMinHeight(child, fi->minHeight);
- if (fi->maxWidth >= 0.0f) YGNodeStyleSetMaxWidth(child, fi->maxWidth);
- if (fi->maxHeight >= 0.0f) YGNodeStyleSetMaxHeight(child, fi->maxHeight);
- if (fi->widthPercent >= 0.0f) {
- YGNodeStyleSetWidthPercent(child, fi->widthPercent);
- } else {
- YGNodeStyleSetWidth(child, cw);
- }
- if (fi->heightPercent >= 0.0f) {
- YGNodeStyleSetHeightPercent(child, fi->heightPercent);
- } else {
- YGNodeStyleSetHeight(child, ch);
- }
- } else {
- YGNodeStyleSetFlexGrow(child, 0.0f);
- YGNodeStyleSetFlexShrink(child, 1.0f);
- YGNodeStyleSetFlexBasisAuto(child);
- YGNodeStyleSetWidth(child, cw);
- YGNodeStyleSetHeight(child, ch);
- }
-
- YGNodeInsertChild(root, child, i);
- childNodes.push_back(child);
- }
-
- YGNodeCalculateLayout(root, parentW, parentH, YGDirectionLTR);
-
- for (usize i = 0; i < children.size(); i++) {
- auto& info = children[i];
- auto& childRect = registry.get<UIRect>(info.entity);
-
- f32 yogaLeft = YGNodeLayoutGetLeft(childNodes[i]);
- f32 yogaTop = YGNodeLayoutGetTop(childNodes[i]);
- f32 finalW = YGNodeLayoutGetWidth(childNodes[i]);
- f32 finalH = YGNodeLayoutGetHeight(childNodes[i]);
-
- f32 cpx = childRect.pivot.x;
- f32 cpy = childRect.pivot.y;
- f32 localX = -pivotX * parentW + yogaLeft + cpx * finalW;
- f32 localY = (1.0f - pivotY) * parentH - yogaTop - (1.0f - cpy) * finalH;
-
- auto* transform = registry.tryGet<Transform>(info.entity);
- if (transform) {
- setLayoutPosition(*transform, &childRect, localX, localY);
- }
-
- childRect.computed_size_.x = finalW;
- childRect.computed_size_.y = finalH;
-
- auto* sprite = registry.tryGet<Sprite>(info.entity);
- if (sprite) {
- if (sprite->size.x != finalW || sprite->size.y != finalH) {
- sprite->size.x = finalW;
- sprite->size.y = finalH;
- }
- }
-
- if (registry.has<FlexContainer>(info.entity)) {
- tree.nodes_[info.tree_index].flags |= LAYOUT_DIRTY;
- } else {
- tree.nodes_[info.tree_index].flags &= ~LAYOUT_DIRTY;
- }
- }
-
- YGNodeFreeRecursive(root);
-}
-
-void resolveGridLayoutChildren(
- Registry& registry,
- UITree& tree,
- i32 containerIndex,
- const LayoutRect& cameraRect
-) {
- (void)cameraRect;
- Entity containerEntity = tree.nodes_[containerIndex].entity;
- auto& grid = registry.get<GridLayout>(containerEntity);
- auto& parentRect = registry.get<UIRect>(containerEntity);
-
- f32 pw = parentRect.computed_size_.x;
- f32 ph = parentRect.computed_size_.y;
- f32 pivotX = parentRect.pivot.x;
- f32 pivotY = parentRect.pivot.y;
-
- i32 cols = grid.crossAxisCount;
- if (cols < 1) cols = 1;
- f32 strideX = grid.itemSize.x + grid.spacing.x;
- f32 strideY = grid.itemSize.y + grid.spacing.y;
- bool isVertical = (grid.direction == GridDirection::Vertical);
-
- i32 childIdx = 0;
- for (i32 j = containerIndex + 1; j < static_cast<i32>(tree.nodes_.size()); j++) {
- if (tree.nodes_[j].parent != containerEntity) continue;
- if (tree.nodes_[j].depth != tree.nodes_[containerIndex].depth + 1) continue;
-
- Entity childEntity = tree.nodes_[j].entity;
- auto* childRect = registry.tryGet<UIRect>(childEntity);
- auto* transform = registry.tryGet<Transform>(childEntity);
- if (!childRect || !transform) continue;
-
- i32 col = isVertical ? childIdx % cols : childIdx / cols;
- i32 row = isVertical ? childIdx / cols : childIdx % cols;
-
- childRect->size = grid.itemSize;
- childRect->computed_size_ = grid.itemSize;
-
- f32 localX = -pivotX * pw + col * strideX + childRect->pivot.x * grid.itemSize.x;
- f32 localY = (1.0f - pivotY) * ph - row * strideY - (1.0f - childRect->pivot.y) * grid.itemSize.y;
-
- setLayoutPosition(*transform, childRect, localX, localY);
-
- tree.nodes_[j].flags &= ~LAYOUT_DIRTY;
- childIdx++;
- }
-}
-
// =============================================================================
-// UINode (CSS box) → single-pass Yoga (REARCH_GUI F3)
+// UINode (CSS box) → single-pass Yoga (REARCH_GUI: the single layout model)
// =============================================================================
//
-// A UINode subtree is laid out by ONE Yoga solve (unlike the legacy per-flex-
-// container ephemeral trees): each entity becomes a YGNode, the hierarchy is
-// mirrored, the root is sized to its parent's box, and one YGNodeCalculateLayout
-// resolves the whole subtree. Output is written as the engine's center-based,
-// y-up local Transform (implicit pivot 0.5, matching UIElementPlugin) plus
-// UINode.computed_size_ (read by the renderer/hit-test).
+// A UINode subtree is laid out by ONE Yoga solve: each entity becomes a YGNode,
+// the hierarchy is mirrored, the root is sized to its available box, and one
+// YGNodeCalculateLayout resolves the whole subtree. Output is written as the
+// engine's center-based, y-up local Transform (implicit pivot 0.5, matching
+// UIElementPlugin) plus UINode.computed_size_ (read by the renderer/hit-test).
// Dimension.unit codes — mirror the TS DimensionUnit enum.
constexpr u8 DIM_PX = 0, DIM_PERCENT = 1, DIM_AUTO = 2;
@@ -477,7 +180,7 @@ void applyUINodeStyle(Registry& registry, Entity entity, YGNodeRef yg) {
}
// Lay out the UINode subtree rooted at tree index `rootIdx` in one Yoga solve.
-// `availW/H` + `parentPivot*` describe the parent box the root is positioned in.
+// `availW/H` + `parentPivot*` describe the available box the root sits in.
void layoutUINodeSubtree(
Registry& registry, UITree& tree, i32 rootIdx,
f32 availW, f32 availH, f32 parentPivotX, f32 parentPivotY
@@ -489,7 +192,7 @@ void layoutUINodeSubtree(
std::unordered_map<Entity, i32> slotOf; // entity → local slot index
for (i32 k = begin; k < end; ++k) {
Entity e = tree.nodes_[k].entity;
- if (!registry.has<UINode>(e)) continue; // subtrees are homogeneously UINode
+ if (!registry.has<UINode>(e)) continue; // tree is homogeneously UINode
YGNodeRef node = YGNodeNew();
applyUINodeStyle(registry, e, node);
yg[static_cast<usize>(k - begin)] = node;
@@ -524,7 +227,7 @@ void layoutUINodeSubtree(
un.computed_size_.x = fw;
un.computed_size_.y = fh;
- // Position frame = parent box (the root's parent box, else the parent
+ // Position frame = the parent box (root's available box, else the parent
// UINode whose computed_size_ is already set — DFS order guarantees it).
f32 pw, ph, ppx, ppy;
if (k == begin) {
@@ -559,55 +262,23 @@ void unifiedLayoutPass(Registry& registry, UITree& tree, const LayoutRect& camer
continue;
}
- // UINode subtree (CSS box, REARCH_GUI F3): one Yoga solve at the subtree
- // root resolves the whole subtree, so skip past it afterward. The legacy
- // UIRect/anchor path below is untouched.
- if (registry.has<UINode>(node.entity)) {
- bool parentIsUINode = node.parent != INVALID_ENTITY && registry.has<UINode>(node.parent);
- if (!parentIsUINode) {
- f32 availW, availH, ppx, ppy;
- if (node.parent != INVALID_ENTITY && registry.has<UIRect>(node.parent)) {
- auto& pr = registry.get<UIRect>(node.parent);
- availW = pr.computed_size_.x; availH = pr.computed_size_.y;
- ppx = pr.pivot.x; ppy = pr.pivot.y;
- } else {
- availW = cameraRect.right - cameraRect.left;
- availH = cameraRect.top - cameraRect.bottom;
- ppx = 0.5f; ppy = 0.5f;
- }
- layoutUINodeSubtree(registry, tree, i, availW, availH, ppx, ppy);
- }
- i += node.subtree_size;
- continue;
- }
-
- if (node.flags & LAYOUT_DIRTY) {
- bool parentManaged = node.parent != INVALID_ENTITY && (
- registry.has<FlexContainer>(node.parent) ||
- registry.has<GridLayout>(node.parent)
- );
-
- if (!parentManaged) {
- layoutNodeAnchor(registry, node, cameraRect);
- }
-
- if (registry.has<FlexContainer>(node.entity)) {
- resolveFlexChildren(registry, tree, i, cameraRect);
- } else if (registry.has<GridLayout>(node.entity)) {
- resolveGridLayoutChildren(registry, tree, i, cameraRect);
- }
+ // Every node is a UINode. A subtree root (its parent is not a UINode —
+ // a top-level UI element / Canvas) is resolved in one Yoga solve over its
+ // whole subtree; skip past it. The available box is the camera rect.
+ bool parentIsUINode = node.parent != INVALID_ENTITY && registry.has<UINode>(node.parent);
+ if (!parentIsUINode) {
+ f32 availW = cameraRect.right - cameraRect.left;
+ f32 availH = cameraRect.top - cameraRect.bottom;
+ layoutUINodeSubtree(registry, tree, i, availW, availH, 0.5f, 0.5f);
}
-
- node.flags &= ~(LAYOUT_DIRTY | HAS_DIRTY_CHILD);
- i++;
+ i += node.subtree_size;
}
}
} // anonymous namespace
// =============================================================================
-// UISystem method impls that need the anonymous-namespace helpers above
-// (hitTestUpdate lives in UISystem.cpp since it only needs UIHitTestSystem.hpp)
+// UISystem layout entry (defined here to share the anon-namespace helpers)
// =============================================================================
void UISystem::layoutUpdate(
diff --git a/src/esengine/ecs/UILayoutSystem.hpp b/src/esengine/ecs/UILayoutSystem.hpp
index 9e15dc265..ab9ae9086 100644
--- a/src/esengine/ecs/UILayoutSystem.hpp
+++ b/src/esengine/ecs/UILayoutSystem.hpp
@@ -4,12 +4,12 @@
#include "Registry.hpp"
#include "UITree.hpp"
-#include "components/UIRect.hpp"
#include <glm/glm.hpp>
namespace esengine::ecs {
+// The available box (camera rect) the UI subtree is laid out within.
struct LayoutRect {
f32 left;
f32 bottom;
@@ -17,19 +17,6 @@ struct LayoutRect {
f32 top;
};
-struct LayoutResult {
- f32 origin_x;
- f32 origin_y;
- LayoutRect rect;
-};
-
-LayoutResult computeAnchorLayout(
- const glm::vec2& anchorMin, const glm::vec2& anchorMax,
- const glm::vec2& offsetMin, const glm::vec2& offsetMax,
- const glm::vec2& size, const LayoutRect& parentRect,
- const glm::vec2& pivot
-);
-
// Layout and tree operations are methods on UISystem (see UISystem.hpp).
// Previously free functions (uiLayoutUpdate, getUITree, uiTreeMarkStructureDirty,
// uiTreeMarkDirty) lived here but held state in a file-level static; that
diff --git a/src/esengine/ecs/UIRenderOrderSystem.hpp b/src/esengine/ecs/UIRenderOrderSystem.hpp
index ff55e909d..649bceeff 100644
--- a/src/esengine/ecs/UIRenderOrderSystem.hpp
+++ b/src/esengine/ecs/UIRenderOrderSystem.hpp
@@ -4,7 +4,6 @@
#include "Registry.hpp"
#include "components/Hierarchy.hpp"
-#include "components/UIRect.hpp"
#include "components/UINode.hpp"
#include "components/Sprite.hpp"
#include "components/UIRenderer.hpp"
@@ -13,8 +12,7 @@
namespace esengine::ecs {
inline i32 assignRenderOrder(Registry& registry, Entity entity, i32 counter) {
- // A UI render node is anything laid out: legacy UIRect or modern UINode.
- if (registry.has<UIRect>(entity) || registry.has<UINode>(entity)) {
+ if (registry.has<UINode>(entity)) {
auto* uiRenderer = registry.tryGet<UIRenderer>(entity);
if (uiRenderer) {
uiRenderer->uiOrder = counter;
diff --git a/src/esengine/ecs/UISystem.cpp b/src/esengine/ecs/UISystem.cpp
index 8a3009380..c97738f6f 100644
--- a/src/esengine/ecs/UISystem.cpp
+++ b/src/esengine/ecs/UISystem.cpp
@@ -13,7 +13,6 @@
#include "components/Interactable.hpp"
#include "components/Transform.hpp"
#include "components/UIInteraction.hpp"
-#include "components/UIRect.hpp"
#include "components/UINode.hpp"
namespace esengine::ecs {
@@ -44,22 +43,12 @@ void UISystem::hitTestUpdate(
auto& t = registry.get<Transform>(entity);
t.ensureDecomposed();
- // Hit geometry from the modern UINode (CSS box, pivot-centered) or the
- // legacy UIRect.
- f32 baseW, baseH, pivotX, pivotY;
- if (auto* node = registry.tryGet<UINode>(entity)) {
- baseW = node->computed_size_.x;
- baseH = node->computed_size_.y;
- pivotX = 0.5f;
- pivotY = 0.5f;
- } else if (auto* rect = registry.tryGet<UIRect>(entity)) {
- baseW = rect->computed_size_.x > 0.0f ? rect->computed_size_.x : rect->size.x;
- baseH = rect->computed_size_.y > 0.0f ? rect->computed_size_.y : rect->size.y;
- pivotX = rect->pivot.x;
- pivotY = rect->pivot.y;
- } else {
- continue;
- }
+ // Hit geometry from the UINode (CSS box, pivot-centered).
+ auto* node = registry.tryGet<UINode>(entity);
+ if (!node) continue;
+ f32 baseW = node->computed_size_.x;
+ f32 baseH = node->computed_size_.y;
+ f32 pivotX = 0.5f, pivotY = 0.5f;
f32 worldW = baseW * t.worldScale.x;
f32 worldH = baseH * t.worldScale.y;
diff --git a/src/esengine/ecs/UITree.hpp b/src/esengine/ecs/UITree.hpp
index 8c9db6d3c..80d341f0f 100644
--- a/src/esengine/ecs/UITree.hpp
+++ b/src/esengine/ecs/UITree.hpp
@@ -4,7 +4,6 @@
#include "Registry.hpp"
#include "components/Hierarchy.hpp"
-#include "components/UIRect.hpp"
#include "components/UINode.hpp"
#include "components/Canvas.hpp"
#include "components/Transform.hpp"
@@ -31,7 +30,7 @@ struct UITree {
void rebuild(Registry& reg) {
nodes_.clear();
reg.each<Canvas>([&](Entity entity, Canvas&) {
- if (!reg.has<UIRect>(entity) || !reg.has<Transform>(entity)) return;
+ if (!reg.has<UINode>(entity) || !reg.has<Transform>(entity)) return;
buildDFS(reg, entity, INVALID_ENTITY, 0);
});
structure_dirty_ = false;
@@ -80,9 +79,8 @@ struct UITree {
private:
void buildDFS(Registry& reg, Entity entity, Entity layoutParent, u16 depth) {
- // A layout node is anything the layout pass positions: the legacy UIRect
- // (anchor model) or the modern UINode (CSS box, REARCH_GUI F3).
- bool isLayoutNode = reg.has<UIRect>(entity) || reg.has<UINode>(entity);
+ // A layout node is any UINode (the single CSS-box layout model).
+ bool isLayoutNode = reg.has<UINode>(entity);
i32 nodeIndex = -1;
if (isLayoutNode) {
diff --git a/src/esengine/ecs/components/UINode.hpp b/src/esengine/ecs/components/UINode.hpp
index a80426fec..60f123037 100644
--- a/src/esengine/ecs/components/UINode.hpp
+++ b/src/esengine/ecs/components/UINode.hpp
@@ -93,7 +93,7 @@ struct UINode {
glm::vec2 computed_size_{0.0f};
// Set by the tween system for Transform fields it drives, so the layout pass
- // leaves those fields alone this frame (cleared each frame). Mirrors UIRect.
+ // leaves those fields alone this frame (cleared each frame).
u8 anim_override_{0};
static constexpr u8 ANIM_POS_X = 1;
static constexpr u8 ANIM_POS_Y = 2;
diff --git a/src/esengine/ecs/components/UIRect.hpp b/src/esengine/ecs/components/UIRect.hpp
deleted file mode 100644
index 4d69676d8..000000000
--- a/src/esengine/ecs/components/UIRect.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// SPDX-License-Identifier: LicenseRef-PolyForm-Noncommercial-1.0.0
-// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-#pragma once
-
-#include "../../core/Types.hpp"
-#include "../../core/Reflection.hpp"
-#include "../../math/Math.hpp"
-
-namespace esengine::ecs {
-
-ES_COMPONENT()
-struct UIRect {
- ES_PROPERTY(animatable)
- glm::vec2 anchorMin{0.5f, 0.5f};
-
- ES_PROPERTY(animatable)
- glm::vec2 anchorMax{0.5f, 0.5f};
-
- ES_PROPERTY(animatable)
- glm::vec2 offsetMin{0.0f, 0.0f};
-
- ES_PROPERTY(animatable)
- glm::vec2 offsetMax{0.0f, 0.0f};
-
- ES_PROPERTY()
- glm::vec2 size{100.0f, 100.0f};
-
- ES_PROPERTY(animatable)
- glm::vec2 pivot{0.5f, 0.5f};
-
- glm::vec2 computed_size_{0.0f};
-
- u8 anim_override_{0};
- static constexpr u8 ANIM_POS_X = 1;
- static constexpr u8 ANIM_POS_Y = 2;
- static constexpr u8 ANIM_ROT_Z = 4;
- static constexpr u8 ANIM_SCALE_X = 8;
- static constexpr u8 ANIM_SCALE_Y = 16;
-
- UIRect() = default;
-};
-
-} // namespace esengine::ecs
diff --git a/src/esengine/renderer/RenderFrameMask.cpp b/src/esengine/renderer/RenderFrameMask.cpp
index 6d5db8bb1..a2bb68f0c 100644
--- a/src/esengine/renderer/RenderFrameMask.cpp
+++ b/src/esengine/renderer/RenderFrameMask.cpp
@@ -3,7 +3,7 @@
#include "RenderFrame.hpp"
#include "../core/Log.hpp"
#include "../ecs/components/Transform.hpp"
-#include "../ecs/components/UIRect.hpp"
+#include "../ecs/components/UINode.hpp"
#include "../ecs/components/UIMask.hpp"
#include "../ecs/components/Hierarchy.hpp"
@@ -45,20 +45,18 @@ ScreenRect computeMaskScreenRect(
ecs::Registry& registry, Entity entity,
const glm::mat4& vp, i32 vpX, i32 vpY, i32 vpW, i32 vpH
) {
- if (!registry.has<ecs::UIRect>(entity) || !registry.has<ecs::Transform>(entity)) {
+ if (!registry.has<ecs::UINode>(entity) || !registry.has<ecs::Transform>(entity)) {
return {0, 0, 0, 0};
}
- const auto& uiRect = registry.get<ecs::UIRect>(entity);
+ const auto& node = registry.get<ecs::UINode>(entity);
const auto& transform = registry.get<ecs::Transform>(entity);
- f32 sizeX = uiRect.computed_size_.x > 0 ? uiRect.computed_size_.x : uiRect.size.x;
- f32 sizeY = uiRect.computed_size_.y > 0 ? uiRect.computed_size_.y : uiRect.size.y;
- f32 worldW = sizeX * transform.worldScale.x;
- f32 worldH = sizeY * transform.worldScale.y;
+ f32 worldW = node.computed_size_.x * transform.worldScale.x;
+ f32 worldH = node.computed_size_.y * transform.worldScale.y;
f32 cx = transform.worldPosition.x;
f32 cy = transform.worldPosition.y;
- f32 px = uiRect.pivot.x;
- f32 py = uiRect.pivot.y;
+ f32 px = 0.5f; // UINode box is pivot-centered
+ f32 py = 0.5f;
f32 localLeft = -worldW * px;
f32 localRight = worldW * (1.0f - px);
diff --git a/src/esengine/renderer/plugins/SpritePlugin.cpp b/src/esengine/renderer/plugins/SpritePlugin.cpp
index 0fef08a8b..63cf46ad4 100644
--- a/src/esengine/renderer/plugins/SpritePlugin.cpp
+++ b/src/esengine/renderer/plugins/SpritePlugin.cpp
@@ -6,7 +6,7 @@
#include "../Texture.hpp"
#include "../../ecs/components/Transform.hpp"
#include "../../ecs/components/Sprite.hpp"
-#include "../../ecs/components/UIRect.hpp"
+#include "../../ecs/components/UINode.hpp"
#include <cmath>
@@ -24,7 +24,7 @@ void SpritePlugin::collect(RenderCollectContext& collect_ctx) {
for (auto entity : spriteView) {
const auto& sprite = spriteView.get<ecs::Sprite>(entity);
if (!sprite.enabled) continue;
- if (registry.has<ecs::UIRect>(entity)) continue;
+ if (registry.has<ecs::UINode>(entity)) continue; // UI sprites are drawn by UIElementPlugin
auto& transform = spriteView.get<ecs::Transform>(entity);
transform.ensureDecomposed();
diff --git a/src/esengine/renderer/plugins/UIElementPlugin.cpp b/src/esengine/renderer/plugins/UIElementPlugin.cpp
index 9418919fa..e5b8f05e5 100644
--- a/src/esengine/renderer/plugins/UIElementPlugin.cpp
+++ b/src/esengine/renderer/plugins/UIElementPlugin.cpp
@@ -6,7 +6,6 @@
#include "../Texture.hpp"
#include "../../ecs/components/Transform.hpp"
#include "../../ecs/components/UIRenderer.hpp"
-#include "../../ecs/components/UIRect.hpp"
#include "../../ecs/components/UINode.hpp"
#include <cmath>
@@ -26,18 +25,11 @@ void UIElementPlugin::collect(RenderCollectContext& collect_ctx) {
const auto& renderer = uiView.get<ecs::UIRenderer>(entity);
if (!renderer.enabled || renderer.visualType == ecs::UIVisualType::None) continue;
- // Geometry source: the legacy UIRect (anchor, explicit pivot) or the
- // modern UINode (CSS box, REARCH_GUI F3 — always pivot-centered).
- f32 w, h, pivotX, pivotY;
- if (const auto* rect = registry.tryGet<ecs::UIRect>(entity)) {
- w = rect->computed_size_.x; h = rect->computed_size_.y;
- pivotX = rect->pivot.x; pivotY = rect->pivot.y;
- } else if (const auto* node = registry.tryGet<ecs::UINode>(entity)) {
- w = node->computed_size_.x; h = node->computed_size_.y;
- pivotX = 0.5f; pivotY = 0.5f;
- } else {
- continue;
- }
+ // Geometry from the UINode (CSS box) — always pivot-centered.
+ const auto* node = registry.tryGet<ecs::UINode>(entity);
+ if (!node) continue;
+ f32 w = node->computed_size_.x, h = node->computed_size_.y;
+ f32 pivotX = 0.5f, pivotY = 0.5f;
if (w <= 0.0f && h <= 0.0f) continue;
auto& transform = uiView.get<ecs::Transform>(entity);