Skip to content

Commit 9dc90d3

Browse files
feat: cursor position info (#1123)
* Updated protocol and added test for the new PrimaryPointerInfo component * Lint-fix pass
1 parent b281f0c commit 9dc90d3

19 files changed

+122
-81
lines changed

package-lock.json

Lines changed: 7 additions & 7 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-14033082444.commit-84b403d",
9+
"@dcl/protocol": "1.0.0-15216214787.commit-b85a860",
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: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ export const componentDefinitionByName: {
648648
"core::PointerEvents": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPointerEvents>>;
649649
"core::PointerEventsResult": GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBPointerEventsResult>>;
650650
"core::PointerLock": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPointerLock>>;
651+
"core::PrimaryPointerInfo": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPrimaryPointerInfo>>;
651652
"core::Raycast": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycast>>;
652653
"core::RaycastResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycastResult>>;
653654
"core::RealmInfo": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRealmInfo>>;
@@ -2778,6 +2779,22 @@ export namespace PBPosition {
27782779
export function encode(message: PBPosition, writer?: _m0.Writer): _m0.Writer;
27792780
}
27802781

2782+
// @public (undocumented)
2783+
export interface PBPrimaryPointerInfo {
2784+
pointerType?: PointerType | undefined;
2785+
screenCoordinates?: PBVector2 | undefined;
2786+
screenDelta?: PBVector2 | undefined;
2787+
worldRayDirection?: PBVector3 | undefined;
2788+
}
2789+
2790+
// @public (undocumented)
2791+
export namespace PBPrimaryPointerInfo {
2792+
// (undocumented)
2793+
export function decode(input: _m0.Reader | Uint8Array, length?: number): PBPrimaryPointerInfo;
2794+
// (undocumented)
2795+
export function encode(message: PBPrimaryPointerInfo, writer?: _m0.Writer): _m0.Writer;
2796+
}
2797+
27812798
// @public (undocumented)
27822799
export interface PBQuaternion {
27832800
// (undocumented)
@@ -2849,19 +2866,12 @@ export namespace PBRaycastResult {
28492866

28502867
// @public (undocumented)
28512868
export interface PBRealmInfo {
2852-
// (undocumented)
28532869
baseUrl: string;
2854-
// (undocumented)
28552870
commsAdapter: string;
2856-
// (undocumented)
28572871
isConnectedSceneRoom?: boolean | undefined;
2858-
// (undocumented)
28592872
isPreview: boolean;
2860-
// (undocumented)
28612873
networkId: number;
2862-
// (undocumented)
28632874
realmName: string;
2864-
// (undocumented)
28652875
room?: string | undefined;
28662876
}
28672877

@@ -3416,6 +3426,12 @@ export type PointerFilterType = 'none' | 'block';
34163426
// @public (undocumented)
34173427
export const PointerLock: LastWriteWinElementSetComponentDefinition<PBPointerLock>;
34183428

3429+
// @public (undocumented)
3430+
export const enum PointerType {
3431+
POT_MOUSE = 1,
3432+
POT_NONE = 0
3433+
}
3434+
34193435
// @public
34203436
export interface Position {
34213437
// (undocumented)
@@ -3437,6 +3453,9 @@ export type PositionType = 'absolute' | 'relative';
34373453
// @public
34383454
export type PositionUnit = `${number}px` | `${number}%` | number | `${number}` | ScaleUnit;
34393455

3456+
// @public (undocumented)
3457+
export const PrimaryPointerInfo: LastWriteWinElementSetComponentDefinition<PBPrimaryPointerInfo>;
3458+
34403459
// Warning: (ae-missing-release-tag) "ProcessMessageResultType" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
34413460
//
34423461
// @public (undocumented)

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

Lines changed: 9 additions & 9 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-14033082444.commit-84b403d",
16+
"@dcl/protocol": "1.0.0-15216214787.commit-b85a860",
1717
"@dcl/quests-client": "^1.0.3",
1818
"@dcl/quests-manager": "^0.1.4",
1919
"@dcl/rpc": "^1.1.1",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { engine, components } from '../../../packages/@dcl/ecs/src'
2+
import { testComponentSerialization } from './assertion'
3+
4+
describe('Generated PrimaryPointerInfo ProtoBuf', () => {
5+
it('should serialize/deserialize PrimaryPointerInfo', () => {
6+
const primaryPointerInfo = components.PrimaryPointerInfo(engine)
7+
8+
testComponentSerialization(primaryPointerInfo, {
9+
pointerType: 1, // POT_MOUSE
10+
screenCoordinates: { x: 100, y: 200 },
11+
screenDelta: { x: 10, y: 20 },
12+
worldRayDirection: { x: 0, y: 1, z: 0 }
13+
})
14+
15+
testComponentSerialization(primaryPointerInfo, {
16+
pointerType: 0, // POT_NONE
17+
screenCoordinates: { x: 0, y: 0 },
18+
screenDelta: { x: 0, y: 0 },
19+
worldRayDirection: { x: 0, y: 0, z: 0 }
20+
})
21+
})
22+
})

test/snapshots/development-bundles/static-scene.test.ts.crdt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SCENE_COMPILED_JS_SIZE_PROD=462.9k bytes
1+
SCENE_COMPILED_JS_SIZE_PROD=466.3k bytes
22
THE BUNDLE HAS SOURCEMAPS
33
(start empty vm 0.21.0-3680274614.commit-1808aa1)
44
OPCODES ~= 0k
@@ -11,8 +11,8 @@ EVAL test/snapshots/development-bundles/static-scene.test.js
1111
REQUIRE: ~system/EngineApi
1212
REQUIRE: ~system/EngineApi
1313
OPCODES ~= 54k
14-
MALLOC_COUNT = 13735
15-
ALIVE_OBJS_DELTA ~= 2.70k
14+
MALLOC_COUNT = 13832
15+
ALIVE_OBJS_DELTA ~= 2.73k
1616
CALL onStart()
1717
main.crdt: PUT_COMPONENT e=0x200 c=1 t=0 data={"position":{"x":5.880000114440918,"y":2.7916901111602783,"z":7.380000114440918},"rotation":{"x":0,"y":0,"z":0,"w":1},"scale":{"x":1,"y":1,"z":1},"parent":0}
1818
main.crdt: PUT_COMPONENT e=0x202 c=1 t=0 data={"position":{"x":4,"y":0.800000011920929,"z":8},"rotation":{"x":0,"y":0,"z":0,"w":1},"scale":{"x":1,"y":1,"z":1},"parent":0}
@@ -56,4 +56,4 @@ CALL onUpdate(0.1)
5656
OPCODES ~= 3k
5757
MALLOC_COUNT = -5
5858
ALIVE_OBJS_DELTA ~= 0.00k
59-
MEMORY_USAGE_COUNT ~= 1209.86k bytes
59+
MEMORY_USAGE_COUNT ~= 1216.08k bytes

test/snapshots/development-bundles/testing-fw.test.ts.crdt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SCENE_COMPILED_JS_SIZE_PROD=463.4k bytes
1+
SCENE_COMPILED_JS_SIZE_PROD=466.8k bytes
22
THE BUNDLE HAS SOURCEMAPS
33
(start empty vm 0.21.0-3680274614.commit-1808aa1)
44
OPCODES ~= 0k
@@ -11,8 +11,8 @@ EVAL test/snapshots/development-bundles/testing-fw.test.js
1111
REQUIRE: ~system/EngineApi
1212
REQUIRE: ~system/EngineApi
1313
OPCODES ~= 63k
14-
MALLOC_COUNT = 14260
15-
ALIVE_OBJS_DELTA ~= 2.85k
14+
MALLOC_COUNT = 14357
15+
ALIVE_OBJS_DELTA ~= 2.88k
1616
CALL onStart()
1717
LOG: ["Adding one to position.y=0"]
1818
Renderer: PUT_COMPONENT e=0x0 c=1 t=1 data={"position":{"x":1,"y":0,"z":0},"rotation":{"x":0,"y":0,"z":0,"w":1},"scale":{"x":9,"y":9,"z":9},"parent":0}
@@ -64,4 +64,4 @@ CALL onUpdate(0.1)
6464
OPCODES ~= 5k
6565
MALLOC_COUNT = -40
6666
ALIVE_OBJS_DELTA ~= -0.01k
67-
MEMORY_USAGE_COUNT ~= 1218.54k bytes
67+
MEMORY_USAGE_COUNT ~= 1224.77k bytes

test/snapshots/development-bundles/two-way-crdt.test.ts.crdt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SCENE_COMPILED_JS_SIZE_PROD=463.4k bytes
1+
SCENE_COMPILED_JS_SIZE_PROD=466.8k bytes
22
THE BUNDLE HAS SOURCEMAPS
33
(start empty vm 0.21.0-3680274614.commit-1808aa1)
44
OPCODES ~= 0k
@@ -11,8 +11,8 @@ EVAL test/snapshots/development-bundles/two-way-crdt.test.js
1111
REQUIRE: ~system/EngineApi
1212
REQUIRE: ~system/EngineApi
1313
OPCODES ~= 63k
14-
MALLOC_COUNT = 14260
15-
ALIVE_OBJS_DELTA ~= 2.85k
14+
MALLOC_COUNT = 14357
15+
ALIVE_OBJS_DELTA ~= 2.88k
1616
CALL onStart()
1717
LOG: ["Adding one to position.y=0"]
1818
Renderer: PUT_COMPONENT e=0x0 c=1 t=1 data={"position":{"x":1,"y":0,"z":0},"rotation":{"x":0,"y":0,"z":0,"w":1},"scale":{"x":9,"y":9,"z":9},"parent":0}
@@ -64,4 +64,4 @@ CALL onUpdate(0.1)
6464
OPCODES ~= 5k
6565
MALLOC_COUNT = -40
6666
ALIVE_OBJS_DELTA ~= -0.01k
67-
MEMORY_USAGE_COUNT ~= 1218.55k bytes
67+
MEMORY_USAGE_COUNT ~= 1224.77k bytes

test/snapshots/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/snapshots/production-bundles/append-value-crdt.ts.crdt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SCENE_COMPILED_JS_SIZE_PROD=203.1k bytes
1+
SCENE_COMPILED_JS_SIZE_PROD=204.7k bytes
22
(start empty vm 0.21.0-3680274614.commit-1808aa1)
33
OPCODES ~= 0k
44
MALLOC_COUNT = 1005
@@ -9,8 +9,8 @@ EVAL test/snapshots/production-bundles/append-value-crdt.js
99
REQUIRE: ~system/EngineApi
1010
REQUIRE: ~system/EngineApi
1111
OPCODES ~= 65k
12-
MALLOC_COUNT = 12784
13-
ALIVE_OBJS_DELTA ~= 2.85k
12+
MALLOC_COUNT = 12876
13+
ALIVE_OBJS_DELTA ~= 2.87k
1414
CALL onStart()
1515
Renderer: APPEND_VALUE e=0x200 c=1063 t=0 data={"button":0,"hit":{"position":{"x":1,"y":2,"z":3},"globalOrigin":{"x":1,"y":2,"z":3},"direction":{"x":1,"y":2,"z":3},"normalHit":{"x":1,"y":2,"z":3},"length":10,"meshName":"mesh","entityId":512},"state":1,"timestamp":1,"analog":5,"tickNumber":0}
1616
OPCODES ~= 8k
@@ -55,4 +55,4 @@ CALL onUpdate(0.1)
5555
OPCODES ~= 14k
5656
MALLOC_COUNT = 31
5757
ALIVE_OBJS_DELTA ~= 0.01k
58-
MEMORY_USAGE_COUNT ~= 909.89k bytes
58+
MEMORY_USAGE_COUNT ~= 914.82k bytes

test/snapshots/production-bundles/billboard.ts.crdt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SCENE_COMPILED_JS_SIZE_PROD=236.1k bytes
1+
SCENE_COMPILED_JS_SIZE_PROD=237.7k bytes
22
(start empty vm 0.21.0-3680274614.commit-1808aa1)
33
OPCODES ~= 0k
44
MALLOC_COUNT = 1005
@@ -8,9 +8,9 @@ EVAL test/snapshots/production-bundles/billboard.js
88
REQUIRE: long
99
REQUIRE: ~system/EngineApi
1010
REQUIRE: ~system/EngineApi
11-
OPCODES ~= 66k
12-
MALLOC_COUNT = 14892
13-
ALIVE_OBJS_DELTA ~= 3.25k
11+
OPCODES ~= 67k
12+
MALLOC_COUNT = 14984
13+
ALIVE_OBJS_DELTA ~= 3.27k
1414
CALL onStart()
1515
OPCODES ~= 0k
1616
MALLOC_COUNT = 4
@@ -77,4 +77,4 @@ CALL onUpdate(0.1)
7777
OPCODES ~= 10k
7878
MALLOC_COUNT = 0
7979
ALIVE_OBJS_DELTA ~= 0.00k
80-
MEMORY_USAGE_COUNT ~= 1052.18k bytes
80+
MEMORY_USAGE_COUNT ~= 1057.20k bytes

test/snapshots/production-bundles/cube-deleted.ts.crdt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SCENE_COMPILED_JS_SIZE_PROD=199.3k bytes
1+
SCENE_COMPILED_JS_SIZE_PROD=200.9k bytes
22
(start empty vm 0.21.0-3680274614.commit-1808aa1)
33
OPCODES ~= 0k
44
MALLOC_COUNT = 1005
@@ -8,9 +8,9 @@ EVAL test/snapshots/production-bundles/cube-deleted.js
88
REQUIRE: long
99
REQUIRE: ~system/EngineApi
1010
REQUIRE: ~system/EngineApi
11-
OPCODES ~= 55k
12-
MALLOC_COUNT = 11935
13-
ALIVE_OBJS_DELTA ~= 2.63k
11+
OPCODES ~= 56k
12+
MALLOC_COUNT = 12027
13+
ALIVE_OBJS_DELTA ~= 2.65k
1414
CALL onStart()
1515
OPCODES ~= 0k
1616
MALLOC_COUNT = 6
@@ -42,4 +42,4 @@ CALL onUpdate(0.1)
4242
OPCODES ~= 5k
4343
MALLOC_COUNT = 1
4444
ALIVE_OBJS_DELTA ~= 0.00k
45-
MEMORY_USAGE_COUNT ~= 872.58k bytes
45+
MEMORY_USAGE_COUNT ~= 877.53k bytes

test/snapshots/production-bundles/cube.ts.crdt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SCENE_COMPILED_JS_SIZE_PROD=199.2k bytes
1+
SCENE_COMPILED_JS_SIZE_PROD=200.8k bytes
22
(start empty vm 0.21.0-3680274614.commit-1808aa1)
33
OPCODES ~= 0k
44
MALLOC_COUNT = 1005
@@ -8,9 +8,9 @@ EVAL test/snapshots/production-bundles/cube.js
88
REQUIRE: long
99
REQUIRE: ~system/EngineApi
1010
REQUIRE: ~system/EngineApi
11-
OPCODES ~= 55k
12-
MALLOC_COUNT = 11908
13-
ALIVE_OBJS_DELTA ~= 2.62k
11+
OPCODES ~= 56k
12+
MALLOC_COUNT = 12001
13+
ALIVE_OBJS_DELTA ~= 2.64k
1414
CALL onStart()
1515
OPCODES ~= 0k
1616
MALLOC_COUNT = 6
@@ -32,4 +32,4 @@ CALL onUpdate(0.1)
3232
OPCODES ~= 1k
3333
MALLOC_COUNT = 0
3434
ALIVE_OBJS_DELTA ~= 0.00k
35-
MEMORY_USAGE_COUNT ~= 862.49k bytes
35+
MEMORY_USAGE_COUNT ~= 867.46k bytes

0 commit comments

Comments
 (0)