@dcl/ecs 7.27.1-34478989812.commit-0dce4d2 → 7.27.1-34480514651.commit-2778e4b

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.
@@ -57,22 +57,22 @@ export function createInputSystem(engine) {
57
57
  const arrayCommands = Array.from(commands);
58
58
  for (let i = arrayCommands.length - 1; i >= 0; i--) {
59
59
  const command = arrayCommands[i];
60
+ // Commands are kept sorted by timestamp, so this one and every one
61
+ // below it belongs to a frame that was already accounted for. Stopping
62
+ // on the button state instead would end this entity's whole loop over
63
+ // a button another entity had already reported this frame.
64
+ if (command.timestamp <= globalState.previousFrameMaxTimestamp) {
65
+ break;
66
+ }
60
67
  if (command.timestamp > maxTimestamp) {
61
68
  maxTimestamp = command.timestamp;
62
69
  }
63
- if (command.timestamp > globalState.previousFrameMaxTimestamp) {
64
- globalState.thisFrameCommands.push(command);
65
- }
70
+ globalState.thisFrameCommands.push(command);
66
71
  if (command.state === 0 /* PointerEventType.PET_UP */ || command.state === 1 /* PointerEventType.PET_DOWN */) {
67
72
  const prevCommand = globalState.buttonState.get(command.button);
68
73
  if (!prevCommand || command.timestamp > prevCommand.timestamp) {
69
74
  globalState.buttonState.set(command.button, command);
70
75
  }
71
- else {
72
- // since we are iterating a descending array, we can early finish the
73
- // loop
74
- break;
75
- }
76
76
  }
77
77
  }
78
78
  }
@@ -83,22 +83,22 @@ function createInputSystem(engine) {
83
83
  const arrayCommands = Array.from(commands);
84
84
  for (let i = arrayCommands.length - 1; i >= 0; i--) {
85
85
  const command = arrayCommands[i];
86
+ // Commands are kept sorted by timestamp, so this one and every one
87
+ // below it belongs to a frame that was already accounted for. Stopping
88
+ // on the button state instead would end this entity's whole loop over
89
+ // a button another entity had already reported this frame.
90
+ if (command.timestamp <= globalState.previousFrameMaxTimestamp) {
91
+ break;
92
+ }
86
93
  if (command.timestamp > maxTimestamp) {
87
94
  maxTimestamp = command.timestamp;
88
95
  }
89
- if (command.timestamp > globalState.previousFrameMaxTimestamp) {
90
- globalState.thisFrameCommands.push(command);
91
- }
96
+ globalState.thisFrameCommands.push(command);
92
97
  if (command.state === 0 /* PointerEventType.PET_UP */ || command.state === 1 /* PointerEventType.PET_DOWN */) {
93
98
  const prevCommand = globalState.buttonState.get(command.button);
94
99
  if (!prevCommand || command.timestamp > prevCommand.timestamp) {
95
100
  globalState.buttonState.set(command.button, command);
96
101
  }
97
- else {
98
- // since we are iterating a descending array, we can early finish the
99
- // loop
100
- break;
101
- }
102
102
  }
103
103
  }
104
104
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dcl/ecs",
3
3
  "description": "Decentraland ECS",
4
- "version": "7.27.1-34478989812.commit-0dce4d2",
4
+ "version": "7.27.1-34480514651.commit-2778e4b",
5
5
  "author": "DCL",
6
6
  "bugs": "https://github.com/decentraland/ecs/issues",
7
7
  "files": [
@@ -34,5 +34,5 @@
34
34
  "dependencies": {},
35
35
  "types": "./dist/index.d.ts",
36
36
  "typings": "./dist/index.d.ts",
37
- "commit": "0dce4d2d791418f47f0e3026829d2559e909afbd"
37
+ "commit": "2778e4bb891f1626a98380a8c906e5e793b74024"
38
38
  }