@dcl/ecs 7.18.2-21453292414.commit-1da934f → 7.18.2-21457748765.commit-7ae2e38

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.
@@ -14,6 +14,29 @@ import { InputAction, PointerEventType } from "./common/input_action.gen";
14
14
  *
15
15
  * It also supports simple visual feedback when interactions occur, by showing floating text.
16
16
  * More sophisticated feedback requires the use of other components.
17
+ *
18
+ * Distance rules
19
+ * --------------
20
+ * PointerEvents can enforce interaction range using two independent distance checks:
21
+ *
22
+ * - Camera distance (`max_distance`): distance from the active camera to the target entity.
23
+ * - Player distance (`max_player_distance`): distance from the avatar/player position to the target entity.
24
+ *
25
+ * How the interaction checks are combined:
26
+ *
27
+ * 1) Only `max_distance` is present
28
+ * - The interaction is allowed only if the camera distance is <= `max_distance`.
29
+ *
30
+ * 2) Only `max_player_distance` is present
31
+ * - The interaction is allowed only if the player distance is <= `max_player_distance`.
32
+ *
33
+ * 3) Both `max_distance` and `max_player_distance` are present
34
+ * - The interaction is allowed if ANY of the checks passes (OR logic):
35
+ * (camera distance <= `max_distance`) OR (player distance <= `max_player_distance`).
36
+ *
37
+ * 4) Neither `max_distance` nor `max_player_distance` is present
38
+ * - The system behaves as if `max_distance` were set to its default value (10),
39
+ * i.e., it uses the camera distance check with a threshold of 10.
17
40
  */
18
41
  /**
19
42
  * @public
@@ -36,6 +59,8 @@ export interface PBPointerEvents_Info {
36
59
  showFeedback?: boolean | undefined;
37
60
  /** enable or disable hover highlight (default true) */
38
61
  showHighlight?: boolean | undefined;
62
+ /** range of interaction from the avatar's position (default 0) */
63
+ maxPlayerDistance?: number | undefined;
39
64
  }
40
65
  /**
41
66
  * @public
@@ -46,6 +46,7 @@ function createBasePBPointerEvents_Info() {
46
46
  maxDistance: undefined,
47
47
  showFeedback: undefined,
48
48
  showHighlight: undefined,
49
+ maxPlayerDistance: undefined,
49
50
  };
50
51
  }
51
52
  /**
@@ -69,6 +70,9 @@ export var PBPointerEvents_Info;
69
70
  if (message.showHighlight !== undefined) {
70
71
  writer.uint32(40).bool(message.showHighlight);
71
72
  }
73
+ if (message.maxPlayerDistance !== undefined) {
74
+ writer.uint32(53).float(message.maxPlayerDistance);
75
+ }
72
76
  return writer;
73
77
  }
74
78
  PBPointerEvents_Info.encode = encode;
@@ -109,6 +113,12 @@ export var PBPointerEvents_Info;
109
113
  }
110
114
  message.showHighlight = reader.bool();
111
115
  continue;
116
+ case 6:
117
+ if (tag !== 53) {
118
+ break;
119
+ }
120
+ message.maxPlayerDistance = reader.float();
121
+ continue;
112
122
  }
113
123
  if ((tag & 7) === 4 || tag === 0) {
114
124
  break;
@@ -16,6 +16,7 @@ export type EventSystemOptions = {
16
16
  maxDistance?: number;
17
17
  showFeedback?: boolean;
18
18
  showHighlight?: boolean;
19
+ maxPlayerDistance?: number;
19
20
  };
20
21
  export declare const getDefaultOpts: (opts?: Partial<EventSystemOptions>) => EventSystemOptions;
21
22
  /**
@@ -32,7 +32,8 @@ export function createPointerEventsSystem(engine, inputSystem) {
32
32
  showFeedback: opts.showFeedback,
33
33
  showHighlight: opts.showHighlight,
34
34
  hoverText: opts.hoverText,
35
- maxDistance: opts.maxDistance
35
+ maxDistance: opts.maxDistance,
36
+ maxPlayerDistance: opts.maxPlayerDistance
36
37
  }
37
38
  });
38
39
  }
@@ -14,6 +14,29 @@ import { InputAction, PointerEventType } from "./common/input_action.gen";
14
14
  *
15
15
  * It also supports simple visual feedback when interactions occur, by showing floating text.
16
16
  * More sophisticated feedback requires the use of other components.
17
+ *
18
+ * Distance rules
19
+ * --------------
20
+ * PointerEvents can enforce interaction range using two independent distance checks:
21
+ *
22
+ * - Camera distance (`max_distance`): distance from the active camera to the target entity.
23
+ * - Player distance (`max_player_distance`): distance from the avatar/player position to the target entity.
24
+ *
25
+ * How the interaction checks are combined:
26
+ *
27
+ * 1) Only `max_distance` is present
28
+ * - The interaction is allowed only if the camera distance is <= `max_distance`.
29
+ *
30
+ * 2) Only `max_player_distance` is present
31
+ * - The interaction is allowed only if the player distance is <= `max_player_distance`.
32
+ *
33
+ * 3) Both `max_distance` and `max_player_distance` are present
34
+ * - The interaction is allowed if ANY of the checks passes (OR logic):
35
+ * (camera distance <= `max_distance`) OR (player distance <= `max_player_distance`).
36
+ *
37
+ * 4) Neither `max_distance` nor `max_player_distance` is present
38
+ * - The system behaves as if `max_distance` were set to its default value (10),
39
+ * i.e., it uses the camera distance check with a threshold of 10.
17
40
  */
18
41
  /**
19
42
  * @public
@@ -36,6 +59,8 @@ export interface PBPointerEvents_Info {
36
59
  showFeedback?: boolean | undefined;
37
60
  /** enable or disable hover highlight (default true) */
38
61
  showHighlight?: boolean | undefined;
62
+ /** range of interaction from the avatar's position (default 0) */
63
+ maxPlayerDistance?: number | undefined;
39
64
  }
40
65
  /**
41
66
  * @public
@@ -52,6 +52,7 @@ function createBasePBPointerEvents_Info() {
52
52
  maxDistance: undefined,
53
53
  showFeedback: undefined,
54
54
  showHighlight: undefined,
55
+ maxPlayerDistance: undefined,
55
56
  };
56
57
  }
57
58
  /**
@@ -75,6 +76,9 @@ var PBPointerEvents_Info;
75
76
  if (message.showHighlight !== undefined) {
76
77
  writer.uint32(40).bool(message.showHighlight);
77
78
  }
79
+ if (message.maxPlayerDistance !== undefined) {
80
+ writer.uint32(53).float(message.maxPlayerDistance);
81
+ }
78
82
  return writer;
79
83
  }
80
84
  PBPointerEvents_Info.encode = encode;
@@ -115,6 +119,12 @@ var PBPointerEvents_Info;
115
119
  }
116
120
  message.showHighlight = reader.bool();
117
121
  continue;
122
+ case 6:
123
+ if (tag !== 53) {
124
+ break;
125
+ }
126
+ message.maxPlayerDistance = reader.float();
127
+ continue;
118
128
  }
119
129
  if ((tag & 7) === 4 || tag === 0) {
120
130
  break;
@@ -16,6 +16,7 @@ export type EventSystemOptions = {
16
16
  maxDistance?: number;
17
17
  showFeedback?: boolean;
18
18
  showHighlight?: boolean;
19
+ maxPlayerDistance?: number;
19
20
  };
20
21
  export declare const getDefaultOpts: (opts?: Partial<EventSystemOptions>) => EventSystemOptions;
21
22
  /**
@@ -59,7 +59,8 @@ function createPointerEventsSystem(engine, inputSystem) {
59
59
  showFeedback: opts.showFeedback,
60
60
  showHighlight: opts.showHighlight,
61
61
  hoverText: opts.hoverText,
62
- maxDistance: opts.maxDistance
62
+ maxDistance: opts.maxDistance,
63
+ maxPlayerDistance: opts.maxPlayerDistance
63
64
  }
64
65
  });
65
66
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dcl/ecs",
3
3
  "description": "Decentraland ECS",
4
- "version": "7.18.2-21453292414.commit-1da934f",
4
+ "version": "7.18.2-21457748765.commit-7ae2e38",
5
5
  "author": "DCL",
6
6
  "bugs": "https://github.com/decentraland/ecs/issues",
7
7
  "files": [
@@ -33,5 +33,5 @@
33
33
  },
34
34
  "types": "./dist/index.d.ts",
35
35
  "typings": "./dist/index.d.ts",
36
- "commit": "1da934f139711792b8d2a7afb0378e8dd70ac44b"
36
+ "commit": "7ae2e3848e600c323d6828ece5bcecd5fd9f3911"
37
37
  }