fix(frontend-player): fix overlay restoration after the elements inspector
This commit is contained in:
parent
6188b38555
commit
e221615c4c
2 changed files with 15 additions and 11 deletions
|
|
@ -31,16 +31,6 @@ export default abstract class BaseScreen {
|
|||
|
||||
const screen = document.createElement('div');
|
||||
|
||||
setTimeout(function() {
|
||||
iframe.contentDocument?.addEventListener('mousemove', function() {
|
||||
overlay.style.display = 'block';
|
||||
})
|
||||
|
||||
overlay.addEventListener('contextmenu', function() {
|
||||
overlay.style.display = 'none';
|
||||
})
|
||||
}, 10)
|
||||
|
||||
screen.className = styles.screen;
|
||||
screen.appendChild(iframe);
|
||||
screen.appendChild(overlay);
|
||||
|
|
@ -58,6 +48,20 @@ export default abstract class BaseScreen {
|
|||
// parentElement.onresize = this.scale;
|
||||
window.addEventListener('resize', this.scale);
|
||||
this.scale();
|
||||
|
||||
/* == For the Inspecting Document content == */
|
||||
this.overlay.addEventListener('contextmenu', () => {
|
||||
this.overlay.style.display = 'none'
|
||||
const doc = this.document
|
||||
if (!doc) { return }
|
||||
const returnOverlay = () => {
|
||||
this.overlay.style.display = 'block'
|
||||
doc.removeEventListener('mousemove', returnOverlay)
|
||||
doc.removeEventListener('mouseclick', returnOverlay) // TODO: prevent default in case of input selection
|
||||
}
|
||||
doc.addEventListener('mousemove', returnOverlay)
|
||||
doc.addEventListener('mouseclick', returnOverlay)
|
||||
})
|
||||
}
|
||||
|
||||
get window(): WindowProxy | null {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
.screen {
|
||||
user-select: none;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
transform-origin: left top;
|
||||
|
|
@ -12,7 +13,6 @@
|
|||
background: white;
|
||||
}
|
||||
.overlay {
|
||||
user-select: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue