Skip to content

Commit

Permalink
fix exception when resizing removes video embed
Browse files Browse the repository at this point in the history
  • Loading branch information
schlawg authored Nov 26, 2024
1 parent 1f8484d commit 311b472
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions ui/analyse/src/study/relay/videoPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ export class VideoPlayer {
if (this.animationFrameId) {
cancelAnimationFrame(this.animationFrameId);
}
if (!el) {
if (!document.body.contains(this.iframe)) return;
document.body.removeChild(this.iframe);
document.body.removeChild(this.close);
}
this.animationFrameId = requestAnimationFrame(() => {
if (!el) {
this.iframe.remove();
this.close.remove();
return;
}
this.iframe.style.display = 'block';
this.iframe.style.left = `${el!.offsetLeft}px`;
this.iframe.style.top = `${el!.offsetTop}px`;
this.iframe.style.width = `${el!.offsetWidth}px`;
this.iframe.style.height = `${el!.offsetHeight}px`;
this.close.style.left = `${el!.offsetLeft + el!.offsetWidth - 16}px`;
this.close.style.top = `${el!.offsetTop - 4}px`;
this.iframe.style.left = `${el.offsetLeft}px`;
this.iframe.style.top = `${el.offsetTop}px`;
this.iframe.style.width = `${el.offsetWidth}px`;
this.iframe.style.height = `${el.offsetHeight}px`;
this.close.style.left = `${el.offsetLeft + el!.offsetWidth - 16}px`;
this.close.style.top = `${el.offsetTop - 4}px`;
if (document.body.contains(this.iframe)) return;
document.body.appendChild(this.iframe);
document.body.appendChild(this.close);
Expand Down

0 comments on commit 311b472

Please sign in to comment.