@dcl/playground-assets 7.0.6-4183962432.commit-2fbe270 → 7.0.6-4195735563.commit-275390b
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/alpha.d.ts +1 -1
- package/dist/beta.d.ts +1 -1
- package/dist/index.bundled.d.ts +1 -1
- package/dist/index.js +20 -3
- 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/dist/playground-assets.d.ts +1 -1
- package/etc/playground-assets.api.json +1 -1
- package/etc/playground-assets.api.md +1 -1
- package/package.json +3 -3
package/dist/alpha.d.ts
CHANGED
|
@@ -1762,7 +1762,7 @@ export declare type IInputSystem = {
|
|
|
1762
1762
|
* @param entity - the entity to query, ignore for global
|
|
1763
1763
|
* @returns boolean
|
|
1764
1764
|
*/
|
|
1765
|
-
isTriggered: (inputAction: InputAction, pointerEventType: PointerEventType, entity
|
|
1765
|
+
isTriggered: (inputAction: InputAction, pointerEventType: PointerEventType, entity?: Entity) => boolean;
|
|
1766
1766
|
/**
|
|
1767
1767
|
* @public
|
|
1768
1768
|
* Check if an input action is currently being pressed.
|
package/dist/beta.d.ts
CHANGED
|
@@ -1758,7 +1758,7 @@ export declare type IInputSystem = {
|
|
|
1758
1758
|
* @param entity - the entity to query, ignore for global
|
|
1759
1759
|
* @returns boolean
|
|
1760
1760
|
*/
|
|
1761
|
-
isTriggered: (inputAction: InputAction, pointerEventType: PointerEventType, entity
|
|
1761
|
+
isTriggered: (inputAction: InputAction, pointerEventType: PointerEventType, entity?: Entity) => boolean;
|
|
1762
1762
|
/**
|
|
1763
1763
|
* @public
|
|
1764
1764
|
* Check if an input action is currently being pressed.
|
package/dist/index.bundled.d.ts
CHANGED
|
@@ -1758,7 +1758,7 @@ export declare type IInputSystem = {
|
|
|
1758
1758
|
* @param entity - the entity to query, ignore for global
|
|
1759
1759
|
* @returns boolean
|
|
1760
1760
|
*/
|
|
1761
|
-
isTriggered: (inputAction: InputAction, pointerEventType: PointerEventType, entity
|
|
1761
|
+
isTriggered: (inputAction: InputAction, pointerEventType: PointerEventType, entity?: Entity) => boolean;
|
|
1762
1762
|
/**
|
|
1763
1763
|
* @public
|
|
1764
1764
|
* Check if an input action is currently being pressed.
|
package/dist/index.js
CHANGED
|
@@ -15439,7 +15439,8 @@
|
|
|
15439
15439
|
const globalState = {
|
|
15440
15440
|
previousFrameMaxTimestamp: 0,
|
|
15441
15441
|
currentFrameMaxTimestamp: 0,
|
|
15442
|
-
buttonState: new Map()
|
|
15442
|
+
buttonState: new Map(),
|
|
15443
|
+
thisFrameCommands: []
|
|
15443
15444
|
};
|
|
15444
15445
|
function findLastAction(pointerEventType, inputAction, entity) {
|
|
15445
15446
|
const ascendingTimestampIterator = PointerEventsResult.get(entity);
|
|
@@ -15461,6 +15462,9 @@
|
|
|
15461
15462
|
// first store the previous' frame timestamp
|
|
15462
15463
|
let maxTimestamp = globalState.currentFrameMaxTimestamp;
|
|
15463
15464
|
globalState.previousFrameMaxTimestamp = maxTimestamp;
|
|
15465
|
+
if (globalState.thisFrameCommands.length) {
|
|
15466
|
+
globalState.thisFrameCommands = [];
|
|
15467
|
+
}
|
|
15464
15468
|
// then iterate over all new commands
|
|
15465
15469
|
for (const [, commands] of engine.getEntitiesWith(PointerEventsResult)) {
|
|
15466
15470
|
// TODO: adapt the gset component to have a cached "reversed" option by default
|
|
@@ -15470,6 +15474,9 @@
|
|
|
15470
15474
|
if (command.timestamp > maxTimestamp) {
|
|
15471
15475
|
maxTimestamp = command.timestamp;
|
|
15472
15476
|
}
|
|
15477
|
+
if (command.timestamp > globalState.previousFrameMaxTimestamp) {
|
|
15478
|
+
globalState.thisFrameCommands.push(command);
|
|
15479
|
+
}
|
|
15473
15480
|
if (command.state === 0 /* PointerEventType.PET_UP */ || command.state === 1 /* PointerEventType.PET_DOWN */) {
|
|
15474
15481
|
const prevCommand = globalState.buttonState.get(command.button);
|
|
15475
15482
|
if (!prevCommand || command.timestamp > prevCommand.timestamp) {
|
|
@@ -15561,8 +15568,18 @@
|
|
|
15561
15568
|
}
|
|
15562
15569
|
// returns true if the provided last action was triggered in the last frame
|
|
15563
15570
|
function isTriggered(inputAction, pointerEventType, entity) {
|
|
15564
|
-
|
|
15565
|
-
|
|
15571
|
+
if (entity) {
|
|
15572
|
+
const command = findLastAction(pointerEventType, inputAction, entity);
|
|
15573
|
+
return (command && timestampIsCurrentFrame(command.timestamp)) || false;
|
|
15574
|
+
}
|
|
15575
|
+
else {
|
|
15576
|
+
for (const command of globalState.thisFrameCommands) {
|
|
15577
|
+
if (command.button === inputAction && command.state === pointerEventType) {
|
|
15578
|
+
return true;
|
|
15579
|
+
}
|
|
15580
|
+
}
|
|
15581
|
+
return false;
|
|
15582
|
+
}
|
|
15566
15583
|
}
|
|
15567
15584
|
// returns the global state of the input. This global state is updated from the system
|
|
15568
15585
|
function isPressed(inputAction) {
|