playcanvas / playcanvas/engine
Touch#getTouchTargetCoords return wrong value when touched on fixed elements
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 16.8k
- Forks
- 2k
- Avg merge
- 4h 32m
- Merged PRs (30d)
- 222
Description
Description
From the source code, we can know that getTouchTargetCoords is based on currentElement, but if the current element is a fixed element, it will return wrong value.
Steps to Reproduce
- Open https://playcanv.as/b/33yrNufe/ on mobile, or open the source project on desktop.
- Move camera distance by two touches, make sure your first touch is on the canvas, and the second touch is on the fixed element

- You will see camera distance updated unexpectedly.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/input/touch.js lines 172-191 and reproduce the problem using the linked mobile demo or source project. Trace getTouchTargetCoords when the second touch is on a fixed element; done means fixed-element touches no longer produce incorrect coordinates or unexpectedly update the camera distance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100