Code Monkey home page Code Monkey logo

Comments (4)

ilyabelkin avatar ilyabelkin commented on August 13, 2024 1

This code works well for the devices I could get hands on. Hope it helps!

	// Set the default
	touchable = true,
 	touches = []; // array of touch vectors;
 
	// TODO: quite fragile; find a better check for touch-ability as the Web standards evolve
	try {
		document.createEvent('TouchEvent'); }
	catch (err) {
		touchable = false;
	}	

from zerobot.

CoretechR avatar CoretechR commented on August 13, 2024 1

Is it really necessary to detect touch ability? Is there any harm by reacting both on mouse and touch events at the same time? If you have a touchscreen computer, you should be able to use both touches and mouse without switching anything.

OK, I've updated the html file. @oskar456 was right, it's not necessary to check for a touchscreen. Both sets of functions can be used simultaneously. So far I have tested the new code on Chrome(with touchscreen and mouse), Edge, Android, Chrome for Android and on iOS without any problems.
I also tried what @ilyabelkin suggested, but somehow it didn't work for me at all.
Thank you all for your help!

from zerobot.

CoretechR avatar CoretechR commented on August 13, 2024

Thank you very much for bringing this to my attention and for providing a fix. I haven't noticed any problems yet, mostly because I'm using Chrome on PC or iOS for testing, which still support the feature. I will definitely look into it.

from zerobot.

oskar456 avatar oskar456 commented on August 13, 2024

Is it really necessary to detect touch ability? Is there any harm by reacting both on mouse and touch events at the same time? If you have a touchscreen computer, you should be able to use both touches and mouse without switching anything.

from zerobot.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.