@dcl/react-ecs 7.27.1-33674365269.commit-d8b9341 → 7.27.1-33752500148.commit-5ae3ef7
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/dist/components/Button/index.js +2 -2
- package/dist/components/Dropdown/index.js +2 -5
- package/dist/components/Input/index.js +2 -5
- package/dist/components/Label/index.js +2 -5
- package/dist/components/listeners/types.d.ts +2 -10
- package/dist/components/listeners/types.js +1 -4
- package/dist/components/uiBackground/types.d.ts +1 -12
- package/dist/components/uiBackground/utils.js +0 -8
- package/dist/components/uiTransform/index.js +3 -5
- package/dist/components/uiTransform/types.d.ts +0 -12
- package/dist/components/uiTransform/utils.js +0 -21
- package/dist/react-ecs.d.ts +0 -3
- package/dist/reconciler/index.d.ts +1 -1
- package/dist/reconciler/index.js +6 -31
- package/dist/reconciler/utils.js +0 -3
- package/dist/system.d.ts +0 -14
- package/dist/system.js +0 -30
- package/package.json +3 -3
|
@@ -29,7 +29,7 @@ function getButtonProps(props) {
|
|
|
29
29
|
*/
|
|
30
30
|
/* @__PURE__ */
|
|
31
31
|
export function Button(props) {
|
|
32
|
-
const { uiTransform, uiBackground, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave,
|
|
32
|
+
const { uiTransform, uiBackground, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, ...otherProps } = props;
|
|
33
33
|
const buttonProps = getButtonProps(props);
|
|
34
34
|
const uiBackgroundProps = parseUiBackground({
|
|
35
35
|
...buttonProps.uiBackground,
|
|
@@ -54,5 +54,5 @@ export function Button(props) {
|
|
|
54
54
|
if (uiBackgroundProps && uiBackgroundProps.color)
|
|
55
55
|
uiBackgroundProps.color.a /= 2;
|
|
56
56
|
}
|
|
57
|
-
return (ReactEcs.createElement("entity", { onMouseDown: !!props.disabled ? undefined : onMouseDown, onMouseUp: !!props.disabled ? undefined : onMouseUp, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave,
|
|
57
|
+
return (ReactEcs.createElement("entity", { onMouseDown: !!props.disabled ? undefined : onMouseDown, onMouseUp: !!props.disabled ? undefined : onMouseUp, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, uiTransform: uiTransformProps, uiText: textProps, uiBackground: uiBackgroundProps }));
|
|
58
58
|
}
|
|
@@ -34,7 +34,7 @@ function parseUiDropdown(props) {
|
|
|
34
34
|
*/
|
|
35
35
|
/* @__PURE__ */
|
|
36
36
|
export function Dropdown(props) {
|
|
37
|
-
const { uiTransform, uiBackground, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave,
|
|
37
|
+
const { uiTransform, uiBackground, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, ...otherProps } = props;
|
|
38
38
|
const dropdownProps = parseUiDropdown(otherProps);
|
|
39
39
|
const commonProps = parseProps({
|
|
40
40
|
uiTransform,
|
|
@@ -42,10 +42,7 @@ export function Dropdown(props) {
|
|
|
42
42
|
onMouseDown,
|
|
43
43
|
onMouseUp,
|
|
44
44
|
onMouseEnter,
|
|
45
|
-
onMouseLeave
|
|
46
|
-
onMouseDrag,
|
|
47
|
-
onMouseDragLocked,
|
|
48
|
-
onMouseDragEnd
|
|
45
|
+
onMouseLeave
|
|
49
46
|
});
|
|
50
47
|
return ReactEcs.createElement("entity", { ...commonProps, uiDropdown: dropdownProps });
|
|
51
48
|
}
|
|
@@ -35,7 +35,7 @@ function parseUiInput(props) {
|
|
|
35
35
|
* @category Component
|
|
36
36
|
*/ /* @__PURE__ */
|
|
37
37
|
export function Input(props) {
|
|
38
|
-
const { uiTransform, uiBackground, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave,
|
|
38
|
+
const { uiTransform, uiBackground, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, ...otherProps } = props;
|
|
39
39
|
const inputProps = parseUiInput(otherProps);
|
|
40
40
|
const commonProps = parseProps({
|
|
41
41
|
uiTransform,
|
|
@@ -43,10 +43,7 @@ export function Input(props) {
|
|
|
43
43
|
onMouseDown,
|
|
44
44
|
onMouseUp,
|
|
45
45
|
onMouseEnter,
|
|
46
|
-
onMouseLeave
|
|
47
|
-
onMouseDrag,
|
|
48
|
-
onMouseDragLocked,
|
|
49
|
-
onMouseDragEnd
|
|
46
|
+
onMouseLeave
|
|
50
47
|
});
|
|
51
48
|
return ReactEcs.createElement("entity", { ...commonProps, uiInput: inputProps });
|
|
52
49
|
}
|
|
@@ -16,17 +16,14 @@ export { scaleFontSize } from './utils';
|
|
|
16
16
|
*/
|
|
17
17
|
/* @__PURE__ */
|
|
18
18
|
export function Label(props) {
|
|
19
|
-
const { uiTransform, uiBackground, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave,
|
|
19
|
+
const { uiTransform, uiBackground, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, ...uiTextProps } = props;
|
|
20
20
|
const commonProps = parseProps({
|
|
21
21
|
uiTransform,
|
|
22
22
|
uiBackground,
|
|
23
23
|
onMouseDown,
|
|
24
24
|
onMouseUp,
|
|
25
25
|
onMouseEnter,
|
|
26
|
-
onMouseLeave
|
|
27
|
-
onMouseDrag,
|
|
28
|
-
onMouseDragLocked,
|
|
29
|
-
onMouseDragEnd
|
|
26
|
+
onMouseLeave
|
|
30
27
|
});
|
|
31
28
|
const { font, textAlign, fontSize, textWrap, ...textProps } = uiTextProps;
|
|
32
29
|
const uiText = {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { PBPointerEventsResult } from '@dcl/ecs';
|
|
2
1
|
/**
|
|
3
|
-
* Callback function to be triggered on a specified event
|
|
4
|
-
* fired it (button, hit, and for drags the pointer delta), which handlers may ignore.
|
|
2
|
+
* Callback function to be triggered on a specified event
|
|
5
3
|
* @public
|
|
6
4
|
*/
|
|
7
|
-
export type Callback = (
|
|
5
|
+
export type Callback = () => void;
|
|
8
6
|
/**
|
|
9
7
|
* User key event Listeners
|
|
10
8
|
* @public
|
|
@@ -18,10 +16,4 @@ export type Listeners = {
|
|
|
18
16
|
onMouseEnter?: Callback;
|
|
19
17
|
/** triggered on mouse leave event */
|
|
20
18
|
onMouseLeave?: Callback;
|
|
21
|
-
/** triggered while the pointer is dragged after pressing on the element */
|
|
22
|
-
onMouseDrag?: Callback;
|
|
23
|
-
/** triggered while the pointer is dragged with the cursor locked in place */
|
|
24
|
-
onMouseDragLocked?: Callback;
|
|
25
|
-
/** triggered when a drag that started on the element ends */
|
|
26
|
-
onMouseDragEnd?: Callback;
|
|
27
19
|
};
|
|
@@ -2,10 +2,7 @@ const listeners = {
|
|
|
2
2
|
onMouseDown: undefined,
|
|
3
3
|
onMouseUp: undefined,
|
|
4
4
|
onMouseEnter: undefined,
|
|
5
|
-
onMouseLeave: undefined
|
|
6
|
-
onMouseDrag: undefined,
|
|
7
|
-
onMouseDragLocked: undefined,
|
|
8
|
-
onMouseDragEnd: undefined
|
|
5
|
+
onMouseLeave: undefined
|
|
9
6
|
};
|
|
10
7
|
const listenersKey = Object.keys(listeners);
|
|
11
8
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BorderRect
|
|
1
|
+
import { BorderRect } from '@dcl/ecs';
|
|
2
2
|
import { Color4 } from '@dcl/ecs/dist/components/generated/pb/decentraland/common/colors.gen';
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
|
@@ -15,8 +15,6 @@ export interface UiBackgroundProps {
|
|
|
15
15
|
uvs?: number[];
|
|
16
16
|
/** AvatarTexture for the background */
|
|
17
17
|
avatarTexture?: UiAvatarTexture;
|
|
18
|
-
/** VideoTexture for the background: the frames of a VideoPlayer on another entity */
|
|
19
|
-
videoTexture?: UiVideoTexture;
|
|
20
18
|
/** Texture for the background */
|
|
21
19
|
texture?: UiTexture;
|
|
22
20
|
}
|
|
@@ -29,15 +27,6 @@ export interface UiAvatarTexture {
|
|
|
29
27
|
wrapMode?: TextureWrapType;
|
|
30
28
|
filterMode?: TextureFilterType;
|
|
31
29
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Video Texture
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
36
|
-
export interface UiVideoTexture {
|
|
37
|
-
videoPlayerEntity: Entity;
|
|
38
|
-
wrapMode?: TextureWrapType;
|
|
39
|
-
filterMode?: TextureFilterType;
|
|
40
|
-
}
|
|
41
30
|
/**
|
|
42
31
|
* Texture
|
|
43
32
|
* @public
|
|
@@ -30,14 +30,6 @@ export function getTexture(props) {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
if (props.videoTexture) {
|
|
34
|
-
return {
|
|
35
|
-
tex: {
|
|
36
|
-
$case: 'videoTexture',
|
|
37
|
-
videoTexture: parseTexture(props.videoTexture)
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
33
|
return undefined;
|
|
42
34
|
}
|
|
43
35
|
function parseTexture(texture) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAlign, getDisplay, getFlexDirection, getFlexWrap, getJustify, getOverflow, getPointerFilter, getPositionType,
|
|
1
|
+
import { getAlign, getDisplay, getFlexDirection, getFlexWrap, getJustify, getOverflow, getPointerFilter, getPositionType, parseBorderColor, parseBorderRadius, parseBorderWidth, parsePosition, parseSize } from './utils';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
@@ -60,7 +60,7 @@ const defaultUiTransform = {
|
|
|
60
60
|
*/
|
|
61
61
|
/* @__PURE__ */
|
|
62
62
|
export function parseUiTransform(props = {}) {
|
|
63
|
-
const { height, minHeight, maxHeight, width, minWidth, maxWidth, alignItems, alignContent, flexWrap, borderRadius, borderWidth, borderColor,
|
|
63
|
+
const { height, minHeight, maxHeight, width, minWidth, maxWidth, alignItems, alignContent, flexWrap, borderRadius, borderWidth, borderColor, ...otherProps } = props;
|
|
64
64
|
return {
|
|
65
65
|
...defaultUiTransform,
|
|
66
66
|
...otherProps,
|
|
@@ -86,8 +86,6 @@ export function parseUiTransform(props = {}) {
|
|
|
86
86
|
...(flexWrap && getFlexWrap(flexWrap)),
|
|
87
87
|
...(borderRadius && parseBorderRadius(borderRadius)),
|
|
88
88
|
...(borderWidth && parseBorderWidth(borderWidth)),
|
|
89
|
-
...(borderColor && parseBorderColor(borderColor))
|
|
90
|
-
...(scrollPosition && getScrollPosition(scrollPosition)),
|
|
91
|
-
...(scrollVisible && getScrollVisible(scrollVisible))
|
|
89
|
+
...(borderColor && parseBorderColor(borderColor))
|
|
92
90
|
};
|
|
93
91
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Color4 } from '@dcl/ecs/dist/components/generated/pb/decentraland/common/colors.gen';
|
|
2
|
-
import { Vector2 } from '@dcl/ecs/dist/components/generated/pb/decentraland/common/vectors.gen';
|
|
3
2
|
import { ScaleUnit } from '../types';
|
|
4
3
|
/**
|
|
5
4
|
* unit value specified. i.e. 1 || '100%' || '1px' || '10vw'
|
|
@@ -132,15 +131,4 @@ export interface UiTransformProps {
|
|
|
132
131
|
opacity?: number;
|
|
133
132
|
/** default 0 */
|
|
134
133
|
zIndex?: number;
|
|
135
|
-
/** A reference id for the element, e.g. as a scrollPosition target or for SetUiFocus. default empty */
|
|
136
|
-
elementId?: string;
|
|
137
|
-
/** Scroll offset when overflow is 'scroll': a position, or the elementId of a child to scroll to. default (0, 0) */
|
|
138
|
-
scrollPosition?: Vector2 | string;
|
|
139
|
-
/** Which scrollbars to show when overflow is 'scroll'. default 'both' */
|
|
140
|
-
scrollVisible?: ScrollVisibleType;
|
|
141
134
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Which scrollbars are shown when the overflow is scrollable
|
|
144
|
-
* @public
|
|
145
|
-
*/
|
|
146
|
-
export type ScrollVisibleType = 'horizontal' | 'vertical' | 'both' | 'hidden';
|
|
@@ -244,24 +244,3 @@ const parsePointerFilter = {
|
|
|
244
244
|
none: 0 /* PointerFilterMode.PFM_NONE */,
|
|
245
245
|
block: 1 /* PointerFilterMode.PFM_BLOCK */
|
|
246
246
|
};
|
|
247
|
-
/**
|
|
248
|
-
* @internal
|
|
249
|
-
*/
|
|
250
|
-
export function getScrollPosition(scrollPosition) {
|
|
251
|
-
if (typeof scrollPosition === 'string') {
|
|
252
|
-
return { scrollPosition: { value: { $case: 'reference', reference: scrollPosition } } };
|
|
253
|
-
}
|
|
254
|
-
return { scrollPosition: { value: { $case: 'position', position: scrollPosition } } };
|
|
255
|
-
}
|
|
256
|
-
const parseScrollVisible = {
|
|
257
|
-
both: 0 /* ShowScrollBar.SSB_BOTH */,
|
|
258
|
-
hidden: 3 /* ShowScrollBar.SSB_HIDDEN */,
|
|
259
|
-
horizontal: 2 /* ShowScrollBar.SSB_ONLY_HORIZONTAL */,
|
|
260
|
-
vertical: 1 /* ShowScrollBar.SSB_ONLY_VERTICAL */
|
|
261
|
-
};
|
|
262
|
-
/**
|
|
263
|
-
* @internal
|
|
264
|
-
*/
|
|
265
|
-
export function getScrollVisible(scrollVisible) {
|
|
266
|
-
return { scrollVisible: parseScrollVisible[scrollVisible] };
|
|
267
|
-
}
|
package/dist/react-ecs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Entity, IEngine, PointerEventsSystem } from '@dcl/ecs';
|
|
2
2
|
import { ReactEcs } from '../react-ecs';
|
|
3
|
-
export declare function createReconciler(engine: Pick<IEngine, 'getComponent' | 'addEntity' | 'removeEntity' | 'defineComponentFromSchema' | 'getEntitiesWith'>, pointerEvents: PointerEventsSystem
|
|
3
|
+
export declare function createReconciler(engine: Pick<IEngine, 'getComponent' | 'addEntity' | 'removeEntity' | 'defineComponentFromSchema' | 'getEntitiesWith'>, pointerEvents: PointerEventsSystem): {
|
|
4
4
|
update: (component: ReactEcs.JSX.ReactNode) => number;
|
|
5
5
|
getEntities: () => Entity[];
|
|
6
6
|
};
|
package/dist/reconciler/index.js
CHANGED
|
@@ -8,17 +8,11 @@ function getPointerEnum(pointerKey) {
|
|
|
8
8
|
onMouseDown: 1 /* PointerEventType.PET_DOWN */,
|
|
9
9
|
onMouseUp: 0 /* PointerEventType.PET_UP */,
|
|
10
10
|
onMouseEnter: 2 /* PointerEventType.PET_HOVER_ENTER */,
|
|
11
|
-
onMouseLeave: 3 /* PointerEventType.PET_HOVER_LEAVE
|
|
12
|
-
onMouseDrag: 7 /* PointerEventType.PET_DRAG */,
|
|
13
|
-
onMouseDragLocked: 6 /* PointerEventType.PET_DRAG_LOCKED */,
|
|
14
|
-
onMouseDragEnd: 8 /* PointerEventType.PET_DRAG_END */
|
|
11
|
+
onMouseLeave: 3 /* PointerEventType.PET_HOVER_LEAVE */
|
|
15
12
|
};
|
|
16
13
|
return pointers[pointerKey];
|
|
17
14
|
}
|
|
18
|
-
export function createReconciler(engine, pointerEvents
|
|
19
|
-
// When set, every entity this reconciler creates is parented to it -- a UiCanvas on the root
|
|
20
|
-
// entity then renders the tree to a texture instead of the screen.
|
|
21
|
-
rootEntity) {
|
|
15
|
+
export function createReconciler(engine, pointerEvents) {
|
|
22
16
|
// Store all the entities so when we destroy the UI we can also destroy them
|
|
23
17
|
const entities = new Set();
|
|
24
18
|
// Store the onChange callbacks to be runned every time a Result has changed
|
|
@@ -35,7 +29,6 @@ rootEntity) {
|
|
|
35
29
|
const UiInputResult = components.UiInputResult(engine);
|
|
36
30
|
const UiDropdown = components.UiDropdown(engine);
|
|
37
31
|
const UiDropdownResult = components.UiDropdownResult(engine);
|
|
38
|
-
const Transform = components.Transform(engine);
|
|
39
32
|
const UiInputBinding = components.UiInputBinding(engine);
|
|
40
33
|
// Component ID Helper
|
|
41
34
|
const getComponentId = {
|
|
@@ -46,10 +39,10 @@ rootEntity) {
|
|
|
46
39
|
uiDropdown: UiDropdown.componentId,
|
|
47
40
|
uiInputBinding: UiInputBinding.componentId
|
|
48
41
|
};
|
|
49
|
-
function pointerEventCallback(entity, pointerEvent
|
|
42
|
+
function pointerEventCallback(entity, pointerEvent) {
|
|
50
43
|
const callback = clickEvents.get(entity)?.get(pointerEvent);
|
|
51
44
|
if (callback)
|
|
52
|
-
callback(
|
|
45
|
+
callback();
|
|
53
46
|
return;
|
|
54
47
|
}
|
|
55
48
|
function updateTree(instance, props) {
|
|
@@ -70,15 +63,6 @@ rootEntity) {
|
|
|
70
63
|
else if (update.component === 'onMouseLeave') {
|
|
71
64
|
pointerEvents.removeOnPointerHoverLeave(instance.entity);
|
|
72
65
|
}
|
|
73
|
-
else if (update.component === 'onMouseDrag') {
|
|
74
|
-
pointerEvents.removeOnPointerDrag(instance.entity);
|
|
75
|
-
}
|
|
76
|
-
else if (update.component === 'onMouseDragLocked') {
|
|
77
|
-
pointerEvents.removeOnPointerDragLocked(instance.entity);
|
|
78
|
-
}
|
|
79
|
-
else if (update.component === 'onMouseDragEnd') {
|
|
80
|
-
pointerEvents.removeOnPointerDragEnd(instance.entity);
|
|
81
|
-
}
|
|
82
66
|
return;
|
|
83
67
|
}
|
|
84
68
|
if (update.props) {
|
|
@@ -94,13 +78,7 @@ rootEntity) {
|
|
|
94
78
|
? pointerEvents.onPointerUp
|
|
95
79
|
: update.component === 'onMouseEnter'
|
|
96
80
|
? pointerEvents.onPointerHoverEnter
|
|
97
|
-
: update.component === 'onMouseLeave'
|
|
98
|
-
? pointerEvents.onPointerHoverLeave
|
|
99
|
-
: update.component === 'onMouseDrag'
|
|
100
|
-
? pointerEvents.onPointerDrag
|
|
101
|
-
: update.component === 'onMouseDragLocked'
|
|
102
|
-
? pointerEvents.onPointerDragLocked
|
|
103
|
-
: update.component === 'onMouseDragEnd' && pointerEvents.onPointerDragEnd;
|
|
81
|
+
: update.component === 'onMouseLeave' && pointerEvents.onPointerHoverLeave;
|
|
104
82
|
if (pointerEventSystem) {
|
|
105
83
|
pointerEventSystem({
|
|
106
84
|
entity: instance.entity,
|
|
@@ -110,7 +88,7 @@ rootEntity) {
|
|
|
110
88
|
// This is needed for the renderer to know which entities are clickeables
|
|
111
89
|
showFeedback: true
|
|
112
90
|
}
|
|
113
|
-
}, (
|
|
91
|
+
}, () => pointerEventCallback(instance.entity, pointerEvent));
|
|
114
92
|
}
|
|
115
93
|
}
|
|
116
94
|
}
|
|
@@ -239,9 +217,6 @@ rootEntity) {
|
|
|
239
217
|
...noopConfig,
|
|
240
218
|
createInstance(type, props) {
|
|
241
219
|
const entity = engine.addEntity();
|
|
242
|
-
if (rootEntity !== undefined) {
|
|
243
|
-
Transform.createOrReplace(entity, { parent: rootEntity });
|
|
244
|
-
}
|
|
245
220
|
entities.add(entity);
|
|
246
221
|
const instance = {
|
|
247
222
|
entity,
|
package/dist/reconciler/utils.js
CHANGED
|
@@ -49,9 +49,6 @@ const entityComponent = {
|
|
|
49
49
|
onMouseUp: undefined,
|
|
50
50
|
onMouseEnter: undefined,
|
|
51
51
|
onMouseLeave: undefined,
|
|
52
|
-
onMouseDrag: undefined,
|
|
53
|
-
onMouseDragLocked: undefined,
|
|
54
|
-
onMouseDragEnd: undefined,
|
|
55
52
|
uiInput: undefined,
|
|
56
53
|
uiDropdown: undefined,
|
|
57
54
|
uiInputBinding: undefined
|
package/dist/system.d.ts
CHANGED
|
@@ -74,20 +74,6 @@ export interface ReactBasedUiSystem {
|
|
|
74
74
|
* @param entity - The entity whose UI renderer should be removed
|
|
75
75
|
*/
|
|
76
76
|
removeUiRenderer(entity: Entity): void;
|
|
77
|
-
/**
|
|
78
|
-
* Render a UI tree to a texture. The tree is rooted at `entity`, which must carry a UiCanvas
|
|
79
|
-
* describing the texture; the result can be sampled through `TextureUnion.uiTexture`. Replaces
|
|
80
|
-
* any texture renderer already set on the entity, and is torn down when the entity is removed.
|
|
81
|
-
*
|
|
82
|
-
* @param entity - The UiCanvas entity the UI tree hangs from
|
|
83
|
-
* @param ui - The UI component to render
|
|
84
|
-
*/
|
|
85
|
-
setTextureRenderer(entity: Entity, ui: UiComponent): void;
|
|
86
|
-
/**
|
|
87
|
-
* Remove a texture renderer previously set with setTextureRenderer(), destroying its entities.
|
|
88
|
-
* @param entity - The UiCanvas entity the renderer was set on
|
|
89
|
-
*/
|
|
90
|
-
removeTextureRenderer(entity: Entity): void;
|
|
91
77
|
}
|
|
92
78
|
/**
|
|
93
79
|
* @public
|
package/dist/system.js
CHANGED
|
@@ -47,18 +47,6 @@ export function createReactBasedUiSystem(engine, pointerSystem) {
|
|
|
47
47
|
let uiComponent = undefined;
|
|
48
48
|
let mainOptions = undefined;
|
|
49
49
|
const additionalRenderers = new Map();
|
|
50
|
-
// UI trees rendered to a texture, keyed by their UiCanvas entity. Each needs its own reconciler
|
|
51
|
-
// because the root parent is a per-reconciler property.
|
|
52
|
-
const textureRenderers = new Map();
|
|
53
|
-
function destroyTextureRenderer(entity) {
|
|
54
|
-
const entry = textureRenderers.get(entity);
|
|
55
|
-
if (!entry)
|
|
56
|
-
return;
|
|
57
|
-
textureRenderers.delete(entity);
|
|
58
|
-
for (const uiEntity of entry.renderer.getEntities()) {
|
|
59
|
-
engine.removeEntity(uiEntity);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
50
|
const UiCanvasInformation = ecsComponents.UiCanvasInformation(engine);
|
|
63
51
|
// Unique owner to prevent other UI systems resetting this scale factor.
|
|
64
52
|
const uiScaleFactorOwner = Symbol('react-ecs-ui-scale');
|
|
@@ -174,14 +162,6 @@ export function createReactBasedUiSystem(engine, pointerSystem) {
|
|
|
174
162
|
else {
|
|
175
163
|
renderer.update(null);
|
|
176
164
|
}
|
|
177
|
-
for (const [entity, entry] of textureRenderers) {
|
|
178
|
-
if (engine.getEntityState(entity) === EntityState.Removed) {
|
|
179
|
-
destroyTextureRenderer(entity);
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
entry.renderer.update(React.createElement(entry.ui));
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
165
|
}
|
|
186
166
|
function UiScaleSystem() {
|
|
187
167
|
const canvasInfo = UiCanvasInformation.getOrNull(engine.RootEntity);
|
|
@@ -239,9 +219,6 @@ export function createReactBasedUiSystem(engine, pointerSystem) {
|
|
|
239
219
|
for (const entity of renderer.getEntities()) {
|
|
240
220
|
engine.removeEntity(entity);
|
|
241
221
|
}
|
|
242
|
-
for (const entity of textureRenderers.keys()) {
|
|
243
|
-
destroyTextureRenderer(entity);
|
|
244
|
-
}
|
|
245
222
|
},
|
|
246
223
|
setUiRenderer(ui, options) {
|
|
247
224
|
uiComponent = ui;
|
|
@@ -252,13 +229,6 @@ export function createReactBasedUiSystem(engine, pointerSystem) {
|
|
|
252
229
|
},
|
|
253
230
|
removeUiRenderer(entity) {
|
|
254
231
|
additionalRenderers.delete(entity);
|
|
255
|
-
},
|
|
256
|
-
setTextureRenderer(entity, ui) {
|
|
257
|
-
destroyTextureRenderer(entity);
|
|
258
|
-
textureRenderers.set(entity, { renderer: createReconciler(engine, pointerSystem, entity), ui });
|
|
259
|
-
},
|
|
260
|
-
removeTextureRenderer(entity) {
|
|
261
|
-
destroyTextureRenderer(entity);
|
|
262
232
|
}
|
|
263
233
|
};
|
|
264
234
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/react-ecs",
|
|
3
3
|
"description": "Decentraland ECS",
|
|
4
|
-
"version": "7.27.1-
|
|
4
|
+
"version": "7.27.1-33752500148.commit-5ae3ef7",
|
|
5
5
|
"author": "DCL",
|
|
6
6
|
"bugs": "https://github.com/decentraland/js-sdk-toolchain/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@dcl/ecs": "7.27.1-
|
|
8
|
+
"@dcl/ecs": "7.27.1-33752500148.commit-5ae3ef7",
|
|
9
9
|
"react": "^18.2.0",
|
|
10
10
|
"react-reconciler": "^0.29.0"
|
|
11
11
|
},
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"tsconfig": "./tsconfig.json"
|
|
41
41
|
},
|
|
42
42
|
"types": "./dist/index.d.ts",
|
|
43
|
-
"commit": "
|
|
43
|
+
"commit": "5ae3ef7c921887bc7c78d88284f22fc91b1be4d4"
|
|
44
44
|
}
|