Skip to content

Commit

Permalink
touch-Actions none for only when pointer events are used
Browse files Browse the repository at this point in the history
  • Loading branch information
diyaayay committed Nov 30, 2024
1 parent 3e6a97d commit 7a62bfd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,19 @@ class p5 {
// unhide any hidden canvases that were created
const canvases = document.getElementsByTagName('canvas');

// Apply touchAction = 'none' to canvases if pointer events exist
if (Object.keys(this._events).some(event => event.startsWith('pointer'))) {
for (const k of canvases) {
k.style.touchAction = 'none';
}
}


for (const k of canvases) {
if (k.dataset.hidden === 'true') {
k.style.visibility = '';
delete k.dataset.hidden;
}
k.style.touchAction = 'none';
}

this._lastTargetFrameTime = window.performance.now();
Expand Down

0 comments on commit 7a62bfd

Please sign in to comment.