Skip to content

fix(www): cast mouse coordinates from float to int before gRPC call#579

Closed
Gourav7389 wants to merge 1 commit intosiemens:nextfrom
Gourav7389:gs/fix-mouse-handler
Closed

fix(www): cast mouse coordinates from float to int before gRPC call#579
Gourav7389 wants to merge 1 commit intosiemens:nextfrom
Gourav7389:gs/fix-mouse-handler

Conversation

@Gourav7389
Copy link
Copy Markdown
Contributor

Browser sends normalized float coordinates (e.g. 0.334), which were passed directly to the proto int32 field causing a TypeError. Wrapping with int(float(...)) fixes the crash.

@github-actions github-actions bot requested a review from chombourger April 13, 2026 07:08
Comment thread mtda-www Outdated
@Gourav7389 Gourav7389 changed the title fix(www): cast mouse coordinates from float to int before gRPC call draft: fix(www): cast mouse coordinates from float to int before gRPC call Apr 13, 2026
Browser sends normalized float coordinates (e.g. 0.334), which were
passed directly to the proto int32 field causing a TypeError.
Wrapping with int(float(...)) fixes the crash.

Signed-off-by: Gourav Singh <gouravsingh@siemens.com>
@Gourav7389 Gourav7389 force-pushed the gs/fix-mouse-handler branch from ef9db31 to 5f1f175 Compare April 13, 2026 11:17
@Gourav7389 Gourav7389 changed the title draft: fix(www): cast mouse coordinates from float to int before gRPC call fix(www): cast mouse coordinates from float to int before gRPC call Apr 13, 2026
Comment thread mtda-www
sid = self.get_argument('session', None)
x = float(self.get_argument("x", 0))
y = float(self.get_argument("y", 0))
x = int(float(self.get_argument("x", 0)) * CONSTS.MOUSE.MAX_X)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would cause a double-scaling bug. I would suggest we correct the proto instead (we can accept some signature change). What do you think @fmoessbauer ?

I raised #580

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also vote for changing the proto. This is not widely used yet, so better change it now than later.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants