Skip to content

Conversation

@marklundin
Copy link
Collaborator

Update scale calculation in getEntityAtPointerEvent to use PlayCanvas's DPR. This was not working on some screens where the dpr < 1 (rotated screens)

@marklundin marklundin requested a review from Copilot May 8, 2025 14:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the picking issue on low DPR (dots-per-inch) displays by adjusting the scale calculation in the getEntityAtPointerEvent function to use PlayCanvas's DPR from the graphicsDevice.

  • Update scale factor calculation by incorporating app.graphicsDevice.maxPixelRatio.
  • Minor code cleanup in picker.tsx.
Comments suppressed due to low confidence (1)

packages/lib/src/utils/picker.tsx:65

  • The second 'return null' statement is unreachable after returning the mesh instance. Please remove it to clean up the control flow.
return null

@pkg-pr-new
Copy link

pkg-pr-new bot commented May 8, 2025

Open in StackBlitz

npm i https://pkg.pr.new/playcanvas/react/@playcanvas/react@128

commit: 955de4f

@marklundin marklundin self-assigned this May 8, 2025
@marklundin marklundin added the bug Something isn't working label May 8, 2025
@marklundin marklundin merged commit db3d064 into main May 8, 2025
5 checks passed
@marklundin marklundin deleted the fix-picker-dpr branch May 8, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants