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

[UE5.3] Ensure touch is relative to absolute location of parent rect (#316) #318

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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