Skip to content

Commit 5fa2ec2

Browse files
committed
Remove target from calculateHeight
1 parent 2b2cd0a commit 5fa2ec2

File tree

5 files changed

+60
-77
lines changed

5 files changed

+60
-77
lines changed

package-lock.json

Lines changed: 56 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
"type-fest": "5.2.0",
121121
"typescript": "5.9.3",
122122
"typescript-eslint": "8.41.0",
123-
"vitest": "4.0.10"
123+
"vitest": "4.0.13"
124124
},
125125
"engines": {
126126
"node": "^24.11.0",

src/util/html/dimensions/calculateHeight.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ function calculateHeight(
99
responsive: boolean,
1010
videoWidth: number | undefined,
1111
options: VideomailClientOptions,
12-
target: string,
1312
ratio?: number,
1413
element?: HTMLElement | null,
1514
) {
@@ -19,12 +18,7 @@ function calculateHeight(
1918

2019
let width: number | undefined = videoWidth;
2120

22-
if (width === 0) {
23-
throw createError({
24-
message: `Unable to calculate height for target ${target} when width is zero, while responsive mode is set to ${responsive}`,
25-
options,
26-
});
27-
} else if (responsive && element) {
21+
if (responsive && element) {
2822
const limitedDimension = limitWidth(element, options, width);
2923
width = limitedDimension.value;
3024
}

src/wrappers/visuals/recorder.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,21 +1606,17 @@ class Recorder extends Despot {
16061606

16071607
public calculateHeight(responsive: boolean) {
16081608
let videoWidth: number | undefined;
1609-
let target = "(unknown)";
16101609

16111610
if (this.userMedia) {
1612-
target = "userMedia";
16131611
videoWidth = this.userMedia.getVideoWidth();
16141612
} else if (this.recorderElement) {
1615-
target = "recorderElement";
16161613
videoWidth = this.recorderElement.videoWidth || this.recorderElement.width;
16171614
}
16181615

16191616
return calculateHeight(
16201617
responsive,
16211618
videoWidth,
16221619
this.options,
1623-
target,
16241620
this.getRatio(),
16251621
this.recorderElement,
16261622
);

src/wrappers/visuals/replay.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,12 @@ class Replay extends Despot {
9595

9696
if (!height) {
9797
let element = this.visuals.getElement();
98-
let target: string;
9998

100-
if (element) {
101-
target = "visualsElement";
102-
} else {
99+
if (!element) {
103100
element = document.body;
104-
target = "document body";
105101
}
106102

107-
height = calculateHeight(
108-
responsive,
109-
videoWidth,
110-
this.options,
111-
target,
112-
ratio,
113-
element,
114-
);
103+
height = calculateHeight(responsive, videoWidth, this.options, ratio, element);
115104
}
116105

117106
if (width > 0) {

0 commit comments

Comments
 (0)