@needle-tools/engine 3.2.15-alpha → 3.4.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/needle-engine.js +44005 -36382
- package/dist/needle-engine.min.js +706 -513
- package/dist/needle-engine.umd.cjs +685 -492
- package/lib/engine/codegen/register_types.js +54 -4
- package/lib/engine/codegen/register_types.js.map +1 -1
- package/lib/engine/engine_addressables.d.ts +3 -3
- package/lib/engine/engine_addressables.js +30 -9
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_element.js +1 -1
- package/lib/engine/engine_element.js.map +1 -1
- package/lib/engine/engine_gameobject.d.ts +2 -1
- package/lib/engine/engine_gameobject.js +19 -0
- package/lib/engine/engine_gameobject.js.map +1 -1
- package/lib/engine/engine_input.js +10 -0
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_math.d.ts +4 -0
- package/lib/engine/engine_math.js +6 -0
- package/lib/engine/engine_math.js.map +1 -1
- package/lib/engine/engine_three_utils.js +2 -2
- package/lib/engine/engine_three_utils.js.map +1 -1
- package/lib/engine-components/Animation.js +4 -0
- package/lib/engine-components/Animation.js.map +1 -1
- package/lib/engine-components/AnimatorController.js +7 -2
- package/lib/engine-components/AnimatorController.js.map +1 -1
- package/lib/engine-components/OrbitControls.js +13 -4
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/TransformGizmo.d.ts +8 -4
- package/lib/engine-components/TransformGizmo.js +62 -63
- package/lib/engine-components/TransformGizmo.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +27 -2
- package/lib/engine-components/codegen/components.js +27 -2
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/lib/engine-components/export/usdz/Extension.d.ts +4 -4
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.d.ts +86 -0
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +830 -0
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js.map +1 -0
- package/lib/engine-components/export/usdz/USDZExporter.d.ts +6 -3
- package/lib/engine-components/export/usdz/USDZExporter.js +34 -11
- package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/Animation.d.ts +15 -15
- package/lib/engine-components/export/usdz/extensions/Animation.js +24 -29
- package/lib/engine-components/export/usdz/extensions/Animation.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/DocumentExtension.d.ts +5 -0
- package/lib/engine-components/export/usdz/extensions/DocumentExtension.js +7 -0
- package/lib/engine-components/export/usdz/extensions/DocumentExtension.js.map +1 -0
- package/lib/engine-components/export/usdz/extensions/USDZText.d.ts +47 -0
- package/lib/engine-components/export/usdz/extensions/USDZText.js +114 -0
- package/lib/engine-components/export/usdz/extensions/USDZText.js.map +1 -0
- package/lib/engine-components/export/usdz/extensions/behavior/Actions.d.ts +30 -0
- package/lib/engine-components/export/usdz/extensions/behavior/Actions.js +89 -0
- package/lib/engine-components/export/usdz/extensions/behavior/Actions.js.map +1 -0
- package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.d.ts +23 -0
- package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.js +114 -0
- package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.js.map +1 -0
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +96 -0
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +421 -0
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -0
- package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.d.ts +111 -0
- package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js +409 -0
- package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js.map +1 -0
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/lib/engine-components/ui/BaseUIComponent.d.ts +2 -0
- package/lib/engine-components/ui/BaseUIComponent.js +6 -0
- package/lib/engine-components/ui/BaseUIComponent.js.map +1 -1
- package/lib/engine-components/ui/Button.js +9 -5
- package/lib/engine-components/ui/Button.js.map +1 -1
- package/lib/engine-components/ui/Canvas.d.ts +23 -6
- package/lib/engine-components/ui/Canvas.js +167 -34
- package/lib/engine-components/ui/Canvas.js.map +1 -1
- package/lib/engine-components/ui/EventSystem.d.ts +6 -0
- package/lib/engine-components/ui/EventSystem.js +4 -4
- package/lib/engine-components/ui/EventSystem.js.map +1 -1
- package/lib/engine-components/ui/Graphic.d.ts +5 -2
- package/lib/engine-components/ui/Graphic.js +38 -7
- package/lib/engine-components/ui/Graphic.js.map +1 -1
- package/lib/engine-components/ui/Image.d.ts +1 -0
- package/lib/engine-components/ui/Image.js +14 -5
- package/lib/engine-components/ui/Image.js.map +1 -1
- package/lib/engine-components/ui/InputField.d.ts +1 -0
- package/lib/engine-components/ui/InputField.js +8 -0
- package/lib/engine-components/ui/InputField.js.map +1 -1
- package/lib/engine-components/ui/Interfaces.d.ts +19 -0
- package/lib/engine-components/ui/Interfaces.js +11 -0
- package/lib/engine-components/ui/Interfaces.js.map +1 -1
- package/lib/engine-components/ui/Layout.d.ts +65 -3
- package/lib/engine-components/ui/Layout.js +304 -3
- package/lib/engine-components/ui/Layout.js.map +1 -1
- package/lib/engine-components/ui/Outline.d.ts +7 -0
- package/lib/engine-components/ui/Outline.js +21 -0
- package/lib/engine-components/ui/Outline.js.map +1 -0
- package/lib/engine-components/ui/RectTransform.d.ts +32 -13
- package/lib/engine-components/ui/RectTransform.js +216 -56
- package/lib/engine-components/ui/RectTransform.js.map +1 -1
- package/lib/engine-components/ui/Text.d.ts +13 -10
- package/lib/engine-components/ui/Text.js +177 -246
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/lib/engine-components/utils/LookAt.d.ts +13 -0
- package/lib/engine-components/utils/LookAt.js +66 -0
- package/lib/engine-components/utils/LookAt.js.map +1 -0
- package/lib/engine-components/webxr/WebXRImageTracking.d.ts +12 -3
- package/lib/engine-components/webxr/WebXRImageTracking.js +156 -24
- package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/plugins/vite/reload.js +13 -2
- package/src/engine/codegen/register_types.js +56 -6
- package/src/engine/engine_addressables.ts +28 -10
- package/src/engine/engine_element.ts +1 -1
- package/src/engine/engine_gameobject.ts +19 -1
- package/src/engine/engine_input.ts +11 -0
- package/src/engine/engine_math.ts +10 -0
- package/src/engine/engine_three_utils.ts +2 -2
- package/src/engine-components/Animation.ts +4 -0
- package/src/engine-components/AnimatorController.ts +7 -1
- package/src/engine-components/OrbitControls.ts +14 -6
- package/src/engine-components/TransformGizmo.ts +64 -70
- package/src/engine-components/codegen/components.ts +27 -2
- package/src/engine-components/export/usdz/Extension.ts +4 -5
- package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +1280 -0
- package/src/engine-components/export/usdz/USDZExporter.ts +39 -17
- package/src/engine-components/export/usdz/extensions/Animation.ts +37 -45
- package/src/engine-components/export/usdz/extensions/DocumentExtension.ts +10 -0
- package/src/engine-components/export/usdz/extensions/USDZText.ts +142 -0
- package/src/engine-components/export/usdz/extensions/behavior/Actions.ts +99 -0
- package/src/engine-components/export/usdz/extensions/behavior/Behaviour.ts +181 -0
- package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +503 -0
- package/src/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.ts +459 -0
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +1 -1
- package/src/engine-components/ui/BaseUIComponent.ts +7 -1
- package/src/engine-components/ui/Button.ts +14 -9
- package/src/engine-components/ui/Canvas.ts +178 -39
- package/src/engine-components/ui/EventSystem.ts +16 -9
- package/src/engine-components/ui/Graphic.ts +46 -8
- package/src/engine-components/ui/Image.ts +13 -4
- package/src/engine-components/ui/InputField.ts +9 -1
- package/src/engine-components/ui/Interfaces.ts +39 -3
- package/src/engine-components/ui/Layout.ts +303 -4
- package/src/engine-components/ui/Outline.ts +13 -0
- package/src/engine-components/ui/RectTransform.ts +236 -68
- package/src/engine-components/ui/Text.ts +284 -265
- package/src/engine-components/utils/LookAt.ts +74 -0
- package/src/engine-components/webxr/WebXRImageTracking.ts +179 -31
- package/lib/engine-components/export/usdz/types.d.ts +0 -34
- package/lib/engine-components/export/usdz/types.js +0 -2
- package/lib/engine-components/export/usdz/types.js.map +0 -1
- package/lib/engine-components/ui/Keyboard.d.ts +0 -31
- package/lib/engine-components/ui/Keyboard.js +0 -178
- package/lib/engine-components/ui/Keyboard.js.map +0 -1
- package/src/engine-components/export/usdz/types.ts +0 -39
- package/src/engine-components/ui/Keyboard.ts +0 -204
|
@@ -1,17 +1,316 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ILayoutGroup, IRectTransform, IRectTransformChangedReceiver } from "./Interfaces";
|
|
2
|
+
import { Behaviour, GameObject } from "../Component";
|
|
3
|
+
import { serializable } from "../../engine/engine_serialization";
|
|
4
|
+
import { Canvas } from "./Canvas";
|
|
5
|
+
import { RectTransform } from "./RectTransform";
|
|
6
|
+
import { getParam } from "../../engine/engine_utils";
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
const debug = getParam("debuguilayout");
|
|
9
|
+
|
|
10
|
+
export class Padding {
|
|
11
|
+
@serializable()
|
|
12
|
+
left: number = 0;
|
|
13
|
+
@serializable()
|
|
14
|
+
right: number = 0;
|
|
15
|
+
@serializable()
|
|
16
|
+
top: number = 0;
|
|
17
|
+
@serializable()
|
|
18
|
+
bottom: number = 0;
|
|
19
|
+
|
|
20
|
+
get vertical() {
|
|
21
|
+
return this.top + this.bottom;
|
|
22
|
+
}
|
|
23
|
+
get horizontal() {
|
|
24
|
+
return this.left + this.right;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export enum TextAnchor {
|
|
29
|
+
UpperLeft = 0,
|
|
30
|
+
UpperCenter = 1,
|
|
31
|
+
UpperRight = 2,
|
|
32
|
+
MiddleLeft = 3,
|
|
33
|
+
MiddleCenter = 4,
|
|
34
|
+
MiddleRight = 5,
|
|
35
|
+
LowerLeft = 6,
|
|
36
|
+
LowerCenter = 7,
|
|
37
|
+
LowerRight = 8,
|
|
38
|
+
Custom = 9
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
enum Axis {
|
|
42
|
+
Horizontal = "x",
|
|
43
|
+
Vertical = "y"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export abstract class LayoutGroup extends Behaviour implements ILayoutGroup {
|
|
47
|
+
|
|
48
|
+
private _rectTransform: RectTransform | null = null;
|
|
49
|
+
private get rectTransform() {
|
|
50
|
+
return this._rectTransform;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
onParentRectTransformChanged(_comp: IRectTransform): void {
|
|
54
|
+
this._needsUpdate = true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private _needsUpdate: boolean = false;
|
|
58
|
+
get isDirty(): boolean {
|
|
59
|
+
return this._needsUpdate;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get isLayoutGroup(): boolean {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
updateLayout() {
|
|
67
|
+
if (!this._rectTransform) return;
|
|
68
|
+
if (debug)
|
|
69
|
+
console.warn("Layout Update", this.context.time.frame, this.name);
|
|
70
|
+
this._needsUpdate = false;
|
|
71
|
+
this.onCalculateLayout(this._rectTransform);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// onBeforeRender(): void {
|
|
75
|
+
// this.updateLayout();
|
|
76
|
+
// }
|
|
77
|
+
|
|
78
|
+
@serializable()
|
|
79
|
+
childAlignment: TextAnchor = TextAnchor.UpperLeft;
|
|
80
|
+
|
|
81
|
+
@serializable()
|
|
4
82
|
reverseArrangement: boolean = false;
|
|
83
|
+
|
|
84
|
+
@serializable()
|
|
85
|
+
spacing: number = 0;
|
|
86
|
+
@serializable(Padding)
|
|
87
|
+
padding!: Padding;
|
|
88
|
+
|
|
89
|
+
@serializable()
|
|
90
|
+
minWidth: number = 0;
|
|
91
|
+
@serializable()
|
|
92
|
+
minHeight: number = 0;
|
|
93
|
+
|
|
94
|
+
@serializable()
|
|
95
|
+
flexibleHeight: number = 0;
|
|
96
|
+
@serializable()
|
|
97
|
+
flexibleWidth: number = 0;
|
|
98
|
+
|
|
99
|
+
@serializable()
|
|
100
|
+
preferredHeight: number = 0;
|
|
101
|
+
@serializable()
|
|
102
|
+
preferredWidth: number = 0;
|
|
103
|
+
|
|
104
|
+
start() {
|
|
105
|
+
this._needsUpdate = true;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
onEnable(): void {
|
|
109
|
+
if(debug) console.log(this.name, this);
|
|
110
|
+
this._rectTransform = this.gameObject.getComponent(RectTransform);
|
|
111
|
+
const canvas = this.gameObject.getComponentInParent(Canvas);
|
|
112
|
+
if (canvas) {
|
|
113
|
+
canvas.registerLayoutGroup(this);
|
|
114
|
+
}
|
|
115
|
+
this._needsUpdate = true;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
onDisable(): void {
|
|
119
|
+
const canvas = this.gameObject.getComponentInParent(Canvas);
|
|
120
|
+
if (canvas) {
|
|
121
|
+
canvas.unregisterLayoutGroup(this);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
protected abstract onCalculateLayout(rt: RectTransform);
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
// for animation:
|
|
130
|
+
private set m_Spacing(val) {
|
|
131
|
+
if (val === this.spacing) return;
|
|
132
|
+
this._needsUpdate = true;
|
|
133
|
+
this.spacing = val;
|
|
134
|
+
}
|
|
135
|
+
get m_Spacing() {
|
|
136
|
+
return this.spacing;
|
|
137
|
+
}
|
|
5
138
|
}
|
|
6
139
|
|
|
7
|
-
export class
|
|
140
|
+
export abstract class HorizontalOrVerticalLayoutGroup extends LayoutGroup {
|
|
141
|
+
|
|
142
|
+
@serializable()
|
|
143
|
+
childControlHeight: boolean = true;
|
|
144
|
+
@serializable()
|
|
145
|
+
childControlWidth: boolean = true;
|
|
146
|
+
@serializable()
|
|
147
|
+
childForceExpandHeight: boolean = false;
|
|
148
|
+
@serializable()
|
|
149
|
+
childForceExpandWidth: boolean = false;
|
|
150
|
+
@serializable()
|
|
151
|
+
childScaleHeight: boolean = false;
|
|
152
|
+
@serializable()
|
|
153
|
+
childScaleWidth: boolean = false;
|
|
154
|
+
|
|
155
|
+
protected abstract get primaryAxis(): Axis;
|
|
156
|
+
|
|
157
|
+
protected onCalculateLayout(rect: RectTransform) {
|
|
158
|
+
const axis = this.primaryAxis;
|
|
159
|
+
|
|
160
|
+
const totalWidth = rect.width;
|
|
161
|
+
let actualWidth = totalWidth;
|
|
162
|
+
const totalHeight = rect.height;
|
|
163
|
+
let actualHeight = totalHeight;
|
|
164
|
+
actualWidth -= this.padding.horizontal;
|
|
165
|
+
actualHeight -= this.padding.vertical;
|
|
166
|
+
|
|
167
|
+
// console.log(rt.name, "width=" + totalWidth + ", height=" + totalHeight)
|
|
168
|
+
|
|
169
|
+
const paddingAxis = axis === Axis.Horizontal ? this.padding.horizontal : this.padding.vertical;
|
|
170
|
+
const isHorizontal = axis === Axis.Horizontal;
|
|
171
|
+
const isVertical = !isHorizontal;
|
|
172
|
+
const otherAxis = isHorizontal ? "y" : "x";
|
|
173
|
+
const controlSize = isHorizontal ? this.childControlWidth : this.childControlHeight;
|
|
174
|
+
const controlSizeOtherAxis = isHorizontal ? this.childControlHeight : this.childControlWidth;
|
|
175
|
+
const forceExpandSize = isHorizontal ? this.childForceExpandWidth : this.childForceExpandHeight;
|
|
176
|
+
const forceExpandSizeOtherAxis = isHorizontal ? this.childForceExpandHeight : this.childForceExpandWidth;
|
|
177
|
+
const actualExpandSize = isHorizontal ? actualHeight : actualWidth;
|
|
178
|
+
const totalSpace = isHorizontal ? totalWidth : totalHeight;
|
|
179
|
+
// 0 is left/top, 0.5 is middle, 1 is right/bottom
|
|
180
|
+
const alignmentOnAxis = 0.5 * (isHorizontal ? this.childAlignment % 3 : Math.floor(this.childAlignment / 3));
|
|
181
|
+
|
|
182
|
+
let start = 0;
|
|
183
|
+
if (isHorizontal) {
|
|
184
|
+
start += this.padding.left;
|
|
185
|
+
}
|
|
186
|
+
else
|
|
187
|
+
start += this.padding.top;
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
// Calculate total size of the elements
|
|
191
|
+
let totalChildSize = 0;
|
|
192
|
+
let actualRectTransformChildCount = 0;
|
|
193
|
+
for (let i = 0; i < this.gameObject.children.length; i++) {
|
|
194
|
+
const ch = this.gameObject.children[i];
|
|
195
|
+
const rt = GameObject.getComponent(ch, RectTransform);
|
|
196
|
+
if (rt?.activeAndEnabled) {
|
|
197
|
+
actualRectTransformChildCount += 1;
|
|
198
|
+
if (isHorizontal) {
|
|
199
|
+
totalChildSize += rt.width;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
totalChildSize += rt.height;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
let sizePerChild = 0;
|
|
208
|
+
const totalSpacing = this.spacing * (actualRectTransformChildCount - 1)
|
|
209
|
+
if (forceExpandSize || controlSize) {
|
|
210
|
+
let size = 0;
|
|
211
|
+
if (isHorizontal) {
|
|
212
|
+
size = actualWidth -= totalSpacing;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
size = actualHeight -= totalSpacing;
|
|
216
|
+
}
|
|
217
|
+
if (actualRectTransformChildCount > 0)
|
|
218
|
+
sizePerChild = size / actualRectTransformChildCount;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
let leftOffset = 0;
|
|
222
|
+
leftOffset += this.padding.left;
|
|
223
|
+
leftOffset -= this.padding.right;
|
|
224
|
+
|
|
225
|
+
if (alignmentOnAxis !== 0) {
|
|
226
|
+
start = totalSpace - totalChildSize;
|
|
227
|
+
start *= alignmentOnAxis;
|
|
228
|
+
start -= totalSpacing * alignmentOnAxis;
|
|
229
|
+
if (isHorizontal) {
|
|
230
|
+
start -= this.padding.right * alignmentOnAxis;
|
|
231
|
+
start += this.padding.left * (1 - alignmentOnAxis);
|
|
232
|
+
if (start < this.padding.left) {
|
|
233
|
+
start = this.padding.left;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
start -= this.padding.bottom * alignmentOnAxis;
|
|
238
|
+
start += this.padding.top * (1 - alignmentOnAxis);
|
|
239
|
+
if (start < this.padding.top) {
|
|
240
|
+
start = this.padding.top;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Apply layout
|
|
246
|
+
let k = 0;
|
|
247
|
+
for (let i = 0; i < this.gameObject.children.length; i++) {
|
|
248
|
+
const ch = this.gameObject.children[i];
|
|
249
|
+
const rt = GameObject.getComponent(ch, RectTransform);
|
|
250
|
+
if (rt?.activeAndEnabled) {
|
|
251
|
+
rt.pivot?.set(.5, .5);
|
|
252
|
+
// Horizontal padding
|
|
253
|
+
const x = totalWidth * .5 + leftOffset * .5;
|
|
254
|
+
if (rt.anchoredPosition.x !== x)
|
|
255
|
+
rt.anchoredPosition.x = x;
|
|
256
|
+
const y = totalHeight * -.5
|
|
257
|
+
if (rt.anchoredPosition.y !== y)
|
|
258
|
+
rt.anchoredPosition.y = y;
|
|
259
|
+
// Set the size for the secondary axis (e.g. height for a horizontal layout group)
|
|
260
|
+
if (forceExpandSizeOtherAxis && controlSizeOtherAxis && rt.sizeDelta[otherAxis] !== actualExpandSize) {
|
|
261
|
+
rt.sizeDelta[otherAxis] = actualExpandSize;
|
|
262
|
+
}
|
|
263
|
+
// Set the size for the primary axis (e.g. width for a horizontal layout group)
|
|
264
|
+
if (forceExpandSize && controlSize && rt.sizeDelta[axis] !== sizePerChild) {
|
|
265
|
+
rt.sizeDelta[axis] = sizePerChild
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const size = isHorizontal ? rt.width : rt.height;
|
|
269
|
+
let halfSize = size * .5;
|
|
270
|
+
start += halfSize;
|
|
271
|
+
|
|
272
|
+
if (forceExpandSize) {
|
|
273
|
+
let preferredStart = sizePerChild * (k + 1) - sizePerChild * .5;
|
|
274
|
+
if (preferredStart > start)
|
|
275
|
+
start = preferredStart;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
let value = start;
|
|
279
|
+
if (axis === Axis.Vertical)
|
|
280
|
+
value = -value;
|
|
281
|
+
// Only set the position if it's not already the correct one to avoid triggering the rectTransform dirty event
|
|
282
|
+
if (rt.anchoredPosition[axis] !== value) {
|
|
283
|
+
rt.anchoredPosition[axis] = value
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
start += halfSize;
|
|
287
|
+
start += this.spacing;
|
|
288
|
+
k += 1;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export class VerticalLayoutGroup extends HorizontalOrVerticalLayoutGroup {
|
|
297
|
+
|
|
298
|
+
protected get primaryAxis() {
|
|
299
|
+
return Axis.Vertical;
|
|
300
|
+
}
|
|
8
301
|
|
|
9
302
|
}
|
|
10
303
|
|
|
11
|
-
export class HorizontalLayoutGroup extends
|
|
304
|
+
export class HorizontalLayoutGroup extends HorizontalOrVerticalLayoutGroup {
|
|
305
|
+
|
|
306
|
+
protected get primaryAxis() {
|
|
307
|
+
return Axis.Horizontal;
|
|
308
|
+
}
|
|
12
309
|
|
|
13
310
|
}
|
|
14
311
|
|
|
15
312
|
export class GridLayoutGroup extends LayoutGroup {
|
|
313
|
+
protected onCalculateLayout() {
|
|
314
|
+
}
|
|
16
315
|
|
|
17
316
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RGBAColor } from "../js-extensions";
|
|
2
|
+
import { serializable } from "../../engine/engine_serialization";
|
|
3
|
+
import { Behaviour } from "../Component";
|
|
4
|
+
import { Color, Vector2 } from "three"
|
|
5
|
+
|
|
6
|
+
export class Outline extends Behaviour {
|
|
7
|
+
|
|
8
|
+
@serializable(RGBAColor)
|
|
9
|
+
effectColor?: RGBAColor;
|
|
10
|
+
|
|
11
|
+
@serializable(Vector2)
|
|
12
|
+
effectDistance?: Vector2;
|
|
13
|
+
}
|