fix:适配3.6.2,修复键盘事件失效问题

This commit is contained in:
next 2022-12-11 16:05:14 +08:00
parent f7a300c3e6
commit 9a232daab8
2 changed files with 22 additions and 22 deletions

Binary file not shown.

View File

@ -25,7 +25,7 @@
<div class="contentWrap">
<div id="GameDiv" class="wrapper">
<div id="Cocos3dGameContainer">
<canvas id="GameCanvas"></canvas>
<canvas id="GameCanvas" tabindex="-1" style="background-color: '';"></canvas>
</div>
<div id="splash">
<div class="progress-bar stripes"><span></span></div>
@ -50,26 +50,26 @@
</html>
<script>
document.getElementsByClassName('toolbar')[0].insertAdjacentHTML('afterbegin', '<div><button id="btn-show-tree">Tree</button></div>');
const devtoolsBtn = document.getElementById('btn-show-tree');
let isOpen = !!localStorage.getItem('ccc_devtools_show');
toggle(isOpen);
devtoolsBtn.addEventListener('click', () => {
isOpen = !isOpen;
toggle(isOpen);
}, false);
// document.getElementsByClassName('toolbar')[0].insertAdjacentHTML('afterbegin', '<div><button id="btn-show-tree">Tree</button></div>');
// const devtoolsBtn = document.getElementById('btn-show-tree');
// let isOpen = !!localStorage.getItem('ccc_devtools_show');
// toggle(isOpen);
// devtoolsBtn.addEventListener('click', () => {
// isOpen = !isOpen;
// toggle(isOpen);
// }, false);
function toggle(isOpen) {
const devApp = document.getElementById('dev-app');
window.ccdevShow = isOpen;
if (isOpen) {
devApp.style.display = 'flex';
devtoolsBtn.classList.add('checked');
localStorage.setItem('ccc_devtools_show', 1);
} else {
devApp.style.display = 'none';
devtoolsBtn.classList.remove('checked');
localStorage.removeItem('ccc_devtools_show');
}
}
// function toggle(isOpen) {
// const devApp = document.getElementById('dev-app');
// window.ccdevShow = isOpen;
// if (isOpen) {
// devApp.style.display = 'flex';
// devtoolsBtn.classList.add('checked');
// localStorage.setItem('ccc_devtools_show', 1);
// } else {
// devApp.style.display = 'none';
// devtoolsBtn.classList.remove('checked');
// localStorage.removeItem('ccc_devtools_show');
// }
// }
</script>