@dcl/playground-assets 7.0.6-4087883663.commit-054d424 → 7.0.6-4106539347.commit-b417eb5
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/index.js +21 -23
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/playground/sdk/dcl-sdk.package.json +2 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -15171,12 +15171,29 @@
|
|
|
15171
15171
|
InternalInputStateComponent.getMutable(engine.RootEntity).timestampLastUpdate = state.currentTimestamp;
|
|
15172
15172
|
}
|
|
15173
15173
|
}
|
|
15174
|
+
function* commandIterator() {
|
|
15175
|
+
for (const [, value] of engine.getEntitiesWith(PointerEventsResult)) {
|
|
15176
|
+
yield* value.commands;
|
|
15177
|
+
}
|
|
15178
|
+
}
|
|
15179
|
+
function findLastAction(pointerEventType, inputAction, entity) {
|
|
15180
|
+
let commandToReturn = undefined;
|
|
15181
|
+
for (const command of commandIterator()) {
|
|
15182
|
+
if (command.button === inputAction &&
|
|
15183
|
+
command.state === pointerEventType &&
|
|
15184
|
+
(!entity || (command.hit && entity === command.hit.entityId))) {
|
|
15185
|
+
if (!commandToReturn || command.timestamp >= commandToReturn.timestamp)
|
|
15186
|
+
commandToReturn = command;
|
|
15187
|
+
}
|
|
15188
|
+
}
|
|
15189
|
+
return commandToReturn;
|
|
15190
|
+
}
|
|
15174
15191
|
function buttonStateUpdateSystem() {
|
|
15175
15192
|
const component = PointerEventsResult.getOrNull(engine.RootEntity);
|
|
15176
15193
|
if (!component)
|
|
15177
15194
|
return;
|
|
15178
15195
|
const state = InternalInputStateComponent.getMutable(engine.RootEntity);
|
|
15179
|
-
for (const command of
|
|
15196
|
+
for (const command of commandIterator()) {
|
|
15180
15197
|
if (command.timestamp > state.buttonState[command.button].ts) {
|
|
15181
15198
|
if (command.state === 1 /* PointerEventType.PET_DOWN */) {
|
|
15182
15199
|
state.buttonState[command.button].value = true;
|
|
@@ -15201,16 +15218,12 @@
|
|
|
15201
15218
|
return null;
|
|
15202
15219
|
}
|
|
15203
15220
|
function findClick(inputAction, entity) {
|
|
15204
|
-
const component = PointerEventsResult.getOrNull(engine.RootEntity);
|
|
15205
|
-
if (!component)
|
|
15206
|
-
return null;
|
|
15207
|
-
const commands = component.commands;
|
|
15208
15221
|
// We search the last DOWN command sorted by timestamp
|
|
15209
|
-
const down = findLastAction(
|
|
15222
|
+
const down = findLastAction(1 /* PointerEventType.PET_DOWN */, inputAction, entity);
|
|
15210
15223
|
// We search the last UP command sorted by timestamp
|
|
15211
15224
|
if (!down)
|
|
15212
15225
|
return null;
|
|
15213
|
-
const up = findLastAction(
|
|
15226
|
+
const up = findLastAction(0 /* PointerEventType.PET_UP */, inputAction, entity);
|
|
15214
15227
|
if (!up)
|
|
15215
15228
|
return null;
|
|
15216
15229
|
const state = InternalInputStateComponent.get(engine.RootEntity);
|
|
@@ -15233,11 +15246,8 @@
|
|
|
15233
15246
|
return null;
|
|
15234
15247
|
}
|
|
15235
15248
|
function findInputCommand(inputAction, pointerEventType, entity) {
|
|
15236
|
-
const component = PointerEventsResult.getOrNull(engine.RootEntity);
|
|
15237
|
-
if (!component)
|
|
15238
|
-
return null;
|
|
15239
15249
|
// We search the last pointer Event command sorted by timestamp
|
|
15240
|
-
const command = findLastAction(
|
|
15250
|
+
const command = findLastAction(pointerEventType, inputAction, entity);
|
|
15241
15251
|
if (!command)
|
|
15242
15252
|
return null;
|
|
15243
15253
|
const state = InternalInputStateComponent.get(engine.RootEntity);
|
|
@@ -15271,18 +15281,6 @@
|
|
|
15271
15281
|
isTriggered
|
|
15272
15282
|
};
|
|
15273
15283
|
}
|
|
15274
|
-
function findLastAction(commands, pointerEventType, inputAction, entity) {
|
|
15275
|
-
let commandToReturn = undefined;
|
|
15276
|
-
for (const command of commands) {
|
|
15277
|
-
if (command.button === inputAction &&
|
|
15278
|
-
command.state === pointerEventType &&
|
|
15279
|
-
(!entity || (command.hit && entity === command.hit.entityId))) {
|
|
15280
|
-
if (!commandToReturn || command.timestamp >= commandToReturn.timestamp)
|
|
15281
|
-
commandToReturn = command;
|
|
15282
|
-
}
|
|
15283
|
-
}
|
|
15284
|
-
return commandToReturn;
|
|
15285
|
-
}
|
|
15286
15284
|
|
|
15287
15285
|
function preEngine() {
|
|
15288
15286
|
const entityContainer = EntityContainer();
|