Какое лучшее решение этой проблемы, если я спам ключ F11, который я получаю < /p>
Failed to execute 'insertBefore' on 'Node': The new child element contains the parent.
HierarchyRequestError: Failed to execute 'insertBefore' on 'Node': The new child element contains the parent.
< /code>
Мое решение, о котором я думаю сейчас, пользователь может переключаться только на полный экран на каждые 3 секунды, но, возможно, кто -то может дать мне хорошее решение < /p>
setFullScreenIcon(){
let isTogglingFullScreen = false;
const displayFullScreenIcon = () => {
BaseScene.fullScreenIcon = this.add
.image(0, 0, 'enterFullScreenIcon')
.setOrigin(.5, 1)
.setInteractive();
const fullScreenIconScaleXAndY = BaseScene.windowWidth * .05 / BaseScene.fullScreenIcon.width;
BaseScene.fullScreenIcon.setScale(fullScreenIconScaleXAndY, fullScreenIconScaleXAndY);
};
const toggleFullScreen = () => {
this.scale.isFullscreen ? this.scale.stopFullscreen() : this.scale.startFullscreen();
};
const changeFullScreenIcon = () => {
BaseScene.fullScreenIcon.setTexture(
this.scale.isFullscreen ? "exitFullScreenIcon" : "enterFullScreenIcon"
);
isTogglingFullScreen = false;
}
const setupFullScreenHandlers = () => {
this.input.keyboard.on('keydown-F11', (event) => {
event.preventDefault();
console.log("isTogglingFullScreen: ", isTogglingFullScreen);
if (!isTogglingFullScreen){
console.log("toggleFullScreen called");
isTogglingFullScreen = true;
toggleFullScreen();
}
});
BaseScene.fullScreenIcon.on('pointerdown', toggleFullScreen);
document.addEventListener("fullscreenchange", changeFullScreenIcon);
};
displayFullScreenIcon();
setupFullScreenHandlers();
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... am-f11-key
Не удалось выполнить «INSERTBEFORE» на «Узел» в Phaser 3, если я спам F11 Ключ [закрыто] ⇐ Javascript
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Ошибка: не удалось выполнить «appendChild» на «Узел»: параметр 1 не имеет типа «Узел»
Anonymous » » в форуме Html - 0 Ответы
- 5 Просмотры
-
Последнее сообщение Anonymous
-