Skip to content

Improve Touch events support #4965

@matteobruni

Description

@matteobruni

The touch events code is far from perfect, it doesn't support the multitouch and the tap detection is a mess.
This could be a way to fix multiple issues (#4839 and #4951) in a single change.
Every touch has an identifier and it must be used to track it to see if it's a tap, long tap or a movement. I think the tap can be under 300ms, otherwise it's a long tap that behaves like a movement.
The multitouch support could be difficult, but it can be at least prepared for future implementations

Checklist
  • engine/src/Core/Utils/EventListeners.ts ✅ Commit dcae1ab
• Rewrite the '_touchStart' function to store each touch event in a Map using its identifier as the key. Store the current time as the value. • Rewrite the '_touchEnd' function to calculate the duration of the touch event by subtracting the stored start time from the current time. Use this duration to determine whether the touch event was a tap (less than 300ms), long tap (more than 300ms), or movement. • Rewrite the '_mouseTouchMove' function to handle multiple simultaneous touch events. This will likely involve iterating over all active touch events and updating their positions individually. • Add a new function '_handleMultiTouch' to handle multitouch events. This function should iterate over all active touch events and apply the appropriate interaction for each one. • Update the '_mouseTouchClick' and '_mouseTouchFinish' functions to use the new '_handleMultiTouch' function.
Sandbox Execution Logs
trunk init 1/16 ✓
⡿ Downloading Trunk 1.15.0...
⡿ Downloading Trunk 1.15.0...
⢿ Downloading Trunk 1.15.0...
⣻ Downloading Trunk 1.15.0...
⣽ Downloading Trunk 1.15.0...
⣾ Downloading Trunk 1.15.0...
⣷ Downloading Trunk 1.15.0...
✔ Downloading Trunk 1.15.0... done
⡿ Verifying Trunk sha256...
✔ Verifying Trunk sha256... done
⡿ Unpacking Trunk...
✔ Unpacking Trunk... done


















































✔ 14 linters were enabled (.trunk/trunk.yaml)
  actionlint 1.6.25 (5 github-workflow files)
  checkov 2.4.9 (759 json, 15 yaml files)
  git-diff-check (2429 files)
  markdownlint 0.36.0 (221 markdown files) (created .markdownlint.yaml)
  osv-scanner 1.4.0 (1 lockfile file)
  oxipng 8.0.0 (35 png files)
  prettier 3.0.3 (4 html, 178 javascript, 759 json, 221 markdown, 1 prettier_supported_configs, 2 sass, 864 typescript, 14 yaml files)
  renovate 36.93.7 (2 renovate-config files)
  shellcheck 0.9.0 (1 shell file) (created .shellcheckrc)
  shfmt 3.6.0 (1 shell file)
  svgo 3.0.2 (11 svg files) (created svgo.config.js)
  trivy 0.45.0 (1 lockfile, 14 yaml files)
  trufflehog 3.56.0 (2430 files)
  yamllint 1.32.0 (14 yaml files) (created .yamllint.yaml)
Next Steps
 1. Read documentation
    Our documentation can be found at https://docs.trunk.io
 2. Get help and give feedback
    Join the Trunk community at https://slack.trunk.io
trunk fmt engine/src/Core/Utils/EventListeners.ts 2/16 ❌ (`1`)




  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/2q59V.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 3/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/9g5kY.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 4/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/tzYVm.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 5/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/ohLDK.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 6/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/DfzOg.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 7/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/SjPtk.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 8/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/PRFc3.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 9/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/7UWZT.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 10/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/UnIe2.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 11/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/0yexs.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 12/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/S950s.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 13/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/5EcqJ.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 14/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/FpF7a.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 15/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/DXdId.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk fmt engine/src/Core/Utils/EventListeners.ts 16/16 ❌ (`1`)
  FAILURES  
 prettier  engine/src/Core/Utils/EventListeners.ts  .trunk/out/M5lst.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions