Skip to content

Commit cdf6a90

Browse files
feat: 4088 add z-index support for ui elements (#1127)
* Updated protocol pointers to dev branch * Added zIndex to the react-ecs component and test (cherry picked from commit 7ea5cfd) * Added opacity property to ui elements * Fixed tests * Updated protocol * Updated snapshots * Removed redundant definitions. Added test coverage * Adjusted the default value in test * ui transform test wip * Added more tests. Refactored parseUiTransform utility function to properly handle the new properties * Deep clean and snapshot * Removed redundant tests, removed redundant defaults definitions. * Updated snapshots * Updated default value for opacity and updated snapshots
1 parent 697c1d3 commit cdf6a90

22 files changed

+340
-80
lines changed

package-lock.json

Lines changed: 18 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"bugs": "https://github.com/decentraland/js-sdk-toolchain/issues",
77
"dependencies": {
88
"@actions/core": "^1.10.0",
9-
"@dcl/protocol": "1.0.0-15216214787.commit-b85a860",
9+
"@dcl/protocol": "1.0.0-15560497739.commit-8e03daa",
1010
"@dcl/quickjs-emscripten": "^0.21.0-3680274614.commit-1808aa1",
1111
"@dcl/ts-proto": "1.153.0",
1212
"@types/fs-extra": "^9.0.12",

packages/@dcl/playground-assets/etc/playground-assets.api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3181,6 +3181,7 @@ export interface PBUiTransform {
31813181
// (undocumented)
31823182
minWidth: number;
31833183
minWidthUnit: YGUnit;
3184+
opacity?: number | undefined;
31843185
overflow: YGOverflow;
31853186
// (undocumented)
31863187
paddingBottom: number;
@@ -3215,6 +3216,7 @@ export interface PBUiTransform {
32153216
// (undocumented)
32163217
width: number;
32173218
widthUnit: YGUnit;
3219+
zIndex?: number | undefined;
32183220
}
32193221

32203222
// @public (undocumented)
@@ -4365,12 +4367,14 @@ export interface UiTransformProps {
43654367
maxWidth?: PositionUnit;
43664368
minHeight?: PositionUnit;
43674369
minWidth?: PositionUnit;
4370+
opacity?: number;
43684371
overflow?: OverflowType;
43694372
padding?: Partial<Position> | PositionShorthand;
43704373
pointerFilter?: PointerFilterType;
43714374
position?: Partial<Position> | PositionShorthand;
43724375
positionType?: PositionType;
43734376
width?: PositionUnit | 'auto';
4377+
zIndex?: number;
43744378
}
43754379

43764380
// @public (undocumented)

packages/@dcl/react-ecs/src/components/uiTransform/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ const defaultUiTransform: PBUiTransform = {
7979
flexBasisUnit: YGUnit.YGU_UNDEFINED,
8080
widthUnit: YGUnit.YGU_AUTO,
8181
heightUnit: YGUnit.YGU_UNDEFINED,
82-
pointerFilter: PointerFilterMode.PFM_NONE
82+
pointerFilter: PointerFilterMode.PFM_NONE,
83+
opacity: 1,
84+
zIndex: 0
8385
}
8486

8587
/**

packages/@dcl/react-ecs/src/components/uiTransform/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,9 @@ export interface UiTransformProps {
150150
borderColor?: Record<keyof Partial<Position>, Color4> | Color4 | undefined
151151
borderRadius?: Partial<BorderRadius> | PositionUnit
152152
borderWidth?: Partial<Position> | PositionUnit
153+
154+
/** The opacity property sets the opacity level for an element, it's accumulated across children @defaultValue 1 */
155+
opacity?: number
156+
/** default 0 */
157+
zIndex?: number
153158
}

packages/@dcl/sdk-commands/package-lock.json

Lines changed: 69 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@dcl/sdk-commands/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"@dcl/inspector": "file:../inspector",
1414
"@dcl/linker-dapp": "^0.14.2",
1515
"@dcl/mini-comms": "1.0.1-20230216163137.commit-a4c75be",
16-
"@dcl/protocol": "1.0.0-15216214787.commit-b85a860",
16+
"@dcl/protocol": "1.0.0-15560497739.commit-8e03daa",
1717
"@dcl/quests-client": "^1.0.3",
1818
"@dcl/quests-manager": "^0.1.4",
1919
"@dcl/rpc": "^1.1.1",

test/ecs/components/UiComponent.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ describe('UiTransform component', () => {
8787
borderTopColor: undefined,
8888
borderBottomColor: undefined,
8989
borderLeftColor: undefined,
90-
borderRightColor: undefined
90+
borderRightColor: undefined,
91+
opacity: undefined,
92+
zIndex: undefined
9193
})
9294
})
9395
})

0 commit comments

Comments
 (0)