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

Commit

Permalink
Merge pull request #354 from StomyPX/no_context_event
Browse files Browse the repository at this point in the history
Consume the context menu event instead of sending a mouse up
  • Loading branch information
StomyPX committed Sep 4, 2023
2 parents 6b742d3 + e4946ab commit 6e14dbb
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions Frontend/library/src/Inputs/HoveringMouseEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class HoveringMouseEvents implements IMouseEvents {
if (!this.mouseController.videoElementProvider.isVideoReady()) {
return;
}
Logger.Log(Logger.GetStackTrace(), 'onMouse Up', 6);
const coord =
this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(
mouseEvent.offsetX,
Expand All @@ -102,25 +103,13 @@ export class HoveringMouseEvents implements IMouseEvents {
}

/**
* Handle the mouse context menu event, sends the mouse data to the UE Instance
* Consumes the mouse context event. The UE instance has no equivalent and doesn't need to be informed.
* @param mouseEvent - Mouse Event
*/
handleContextMenu(mouseEvent: MouseEvent) {
if (!this.mouseController.videoElementProvider.isVideoReady()) {
return;
}
const coord =
this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(
mouseEvent.offsetX,
mouseEvent.offsetY
);
const toStreamerHandlers =
this.mouseController.toStreamerMessagesProvider.toStreamerHandlers;
toStreamerHandlers.get('MouseUp')([
mouseEvent.button,
coord.x,
coord.y
]);
mouseEvent.preventDefault();
}

Expand Down Expand Up @@ -177,6 +166,7 @@ export class HoveringMouseEvents implements IMouseEvents {
if (!this.mouseController.videoElementProvider.isVideoReady()) {
return;
}
Logger.Log(Logger.GetStackTrace(), 'onMouse press', 6);
this.mouseController.pressMouseButtons(
mouseEvent.buttons,
mouseEvent.offsetX,
Expand All @@ -192,6 +182,7 @@ export class HoveringMouseEvents implements IMouseEvents {
if (!this.mouseController.videoElementProvider.isVideoReady()) {
return;
}
Logger.Log(Logger.GetStackTrace(), 'onMouse release', 6);
this.mouseController.releaseMouseButtons(
mouseEvent.buttons,
mouseEvent.offsetX,
Expand Down

0 comments on commit 6e14dbb

Please sign in to comment.