Skip to content

Commit

Permalink
Remove 3 unused instance variables and added an explanation of why th…
Browse files Browse the repository at this point in the history
…e aspect ratio of the video is important
  • Loading branch information
dbuezas committed Jun 18, 2023
1 parent da58ed5 commit 15147f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 0 additions & 3 deletions custom_components/webrtc/www/digital-ptz.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ const DEFAULT_OPTIONS = {
persist: true,
};
export class DigitalPTZ {
lastTouches;
lastMouse;
lastTap = 0;
containerEl;
videoEl;
resizeObserver;
Expand Down
4 changes: 4 additions & 0 deletions custom_components/webrtc/www/ditigal-ptz-transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -55,6 +58,7 @@ export class Transform {
);
}
}
// dx,dy are deltas.
move(dx, dy) {
if (!this.videoRect) return;
const bound = (this.scale - 1) / 2;
Expand Down

0 comments on commit 15147f4

Please sign in to comment.