ArnoldSmith86 / virtualtabletop

a virtual surface in the browser on which you can play board, dice and card games
https://virtualtabletop.io
GNU General Public License v3.0
173 stars 31 forks source link

iOS "hold to copy" interferes with enlarge function #2052

Open juandpinto opened 9 months ago

juandpinto commented 9 months ago

On iOS (regardless of browser), the typical "hold to copy" feature is highlights an element when held and brings up a context menu. This makes it difficult to use the enlarge function in VTT (which can be especially useful on small touch-screen devices) since it interferes with the enlarged view and makes things generally awkward to use. This does not appear to be a problem with PCIO, so looking there might provide clues as to how to address this.

I believe the issue maybe as simple as setting the CSS user-select property using -webkit-user-select: none;, but I'd like to look a bit deeper into this. If I can make it work, I'll open a pull request for this.

bjalder26 commented 5 days ago

My guess is that we could prevent this behavior by adding event.preventDefault(); to the top of this function in widget.js.

this.onlongtouch = function(event) {
  this.showEnlarged();
  clearTimeout(this.timer);
  this.timer = null;
  this.domElement.classList.add('longtouch');
}