From 15147f4d32ada104208730200593901f6e972bf5 Mon Sep 17 00:00:00 2001 From: David Buezas Date: Sat, 3 Jun 2023 22:25:18 +0200 Subject: [PATCH] Remove 3 unused instance variables and added an explanation of why the aspect ratio of the video is important --- custom_components/webrtc/www/digital-ptz.js | 3 --- custom_components/webrtc/www/ditigal-ptz-transform.js | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/webrtc/www/digital-ptz.js b/custom_components/webrtc/www/digital-ptz.js index 4c709df..a0e2002 100644 --- a/custom_components/webrtc/www/digital-ptz.js +++ b/custom_components/webrtc/www/digital-ptz.js @@ -22,9 +22,6 @@ const DEFAULT_OPTIONS = { persist: true, }; export class DigitalPTZ { - lastTouches; - lastMouse; - lastTap = 0; containerEl; videoEl; resizeObserver; diff --git a/custom_components/webrtc/www/ditigal-ptz-transform.js b/custom_components/webrtc/www/ditigal-ptz-transform.js index f1ff5c4..a1ca1fc 100644 --- a/custom_components/webrtc/www/ditigal-ptz-transform.js +++ b/custom_components/webrtc/www/ditigal-ptz-transform.js @@ -30,6 +30,9 @@ export class Transform { // Once it loads, the videometadata listener will call this function again. return; } + // When in full screen, and if the aspect ratio of the screen differs from that of the video, + // black bars will be shown either to the sides or above/below the video. + // This needs to be accounted for when panning, the code below keeps track of that. const screenAspectRatio = this.containerRect.width / this.containerRect.height; const videoAspectRatio = videoEl.videoWidth / videoEl.videoHeight; @@ -55,6 +58,7 @@ export class Transform { ); } } + // dx,dy are deltas. move(dx, dy) { if (!this.videoRect) return; const bound = (this.scale - 1) / 2;