Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Ensure touch is relative to absolute location of parent rect (#316)
Browse files Browse the repository at this point in the history
(cherry picked from commit 4e370e5)
  • Loading branch information
StomyPX committed Jul 19, 2023
1 parent 2dea212 commit ee37e8c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Frontend/library/src/Inputs/TouchController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,15 @@ export class TouchController implements ITouchController {
if (!this.videoElementProvider.isVideoReady()) {
return;
}
const videoElementParent =
this.videoElementProvider.getVideoParentElement();
const offset = this.videoElementProvider.getVideoParentElement().getBoundingClientRect();
const toStreamerHandlers =
this.toStreamerMessagesProvider.toStreamerHandlers;

for (let t = 0; t < touches.length; t++) {
const numTouches = 1; // the number of touches to be sent this message
const touch = touches[t];
const x = touch.clientX - videoElementParent.offsetLeft;
const y = touch.clientY - videoElementParent.offsetTop;
const x = touch.clientX - offset.left;
const y = touch.clientY - offset.top;
Logger.Log(
Logger.GetStackTrace(),
`F${this.fingerIds.get(touch.identifier)}=(${x}, ${y})`,
Expand Down

0 comments on commit ee37e8c

Please sign in to comment.