Skip to content

Commit 7fcf0cd

Browse files
committed
Use graphics element, not container element for resize listener
The best explanation is this loom: https://www.loom.com/share/a123d237c47b476db00bc79a0aee0bb8
1 parent e5228bf commit 7fcf0cd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/ui/components/Video/RecordedCursor.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ export function RecordedCursor() {
2727
const originalHeight = height / localScale;
2828
const originalWidth = width / localScale;
2929

30-
const mouseX = (mouseEvent.clientX / originalWidth) * width;
31-
const mouseY = (mouseEvent.clientY / originalHeight) * height;
30+
const mouseX = (mouseEvent.clientX / originalWidth) * 100;
31+
const mouseY = (mouseEvent.clientY / originalHeight) * 100;
3232

3333
const cursorScale = Math.min(1, Math.max(0.25, localScale * recordingScale));
3434

3535
element.style.display = "block";
36-
element.style.left = `${mouseX}px`;
37-
element.style.top = `${mouseY}px`;
36+
element.style.left = `${mouseX}%`;
37+
element.style.top = `${mouseY}%`;
3838
element.style.transform = `scale(${cursorScale})`;
3939
element.style.setProperty("--click-display", shouldDrawClick ? "block" : "none");
4040
} else {

src/ui/components/Video/imperative/subscribeToMutableSources.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function subscribeToMutableSources({
3535
});
3636

3737
// When the graphics element resizes, the mutable state should recalculate the its layout
38-
updateState(containerElement, { didResize: true });
38+
updateState(graphicsElement, { didResize: true });
3939
});
4040

4141
resizeObserver.observe(containerElement);

0 commit comments

Comments
 (0)