Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

add no pause attribute support #409

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,17 @@ Inspector.prototype = {
this.open();
}
},

/**
* Prevent pause elements with data-no-pause attribute while open inspector
*/
playNoPauseElements: function () {
const noPauseElements = document.querySelectorAll(
'a-entity[data-no-pause]'
);
noPauseElements.forEach((elem) => {
elem.play();
});
},
/**
* Open the editor UI
*/
Expand All @@ -261,6 +271,9 @@ Inspector.prototype = {
this.sceneEl.isPlaying = true;
this.cursor.play();

// emit play event on elements with data-no-pause attribute
this.playNoPauseElements();

if (
!focusEl &&
this.isFirstOpen &&
Expand Down