Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to accept stylus input on a HTML5 web page

I want to create a web page where the user would be able to write their signature using a stylus (like when you sign for a parcel or package). Does anyone know if this is possible? I'm not sure exactly where to start but I'm guessing that I would have to use the element and javascript?

like image 841
Pattle Avatar asked Sep 02 '13 10:09

Pattle


3 Answers

It's perfectly possible as long as the device your client will be using supports touch input using stylus.

You can see this tutorial to see how to use <canvas> element to create a simple drawing app.

To see which browsers support canvas, see this page.

like image 144
kamituel Avatar answered Oct 19 '22 17:10

kamituel


If you specifically want stylus support, you'll want to support features beyond the typical mouse x,y coordinates.

Currently, only stylus-specific input I know of is the Wacom Web plugin/API. This supports these features like stylus pressure, stylus angle, and multi-touch for the web.

http://www.wacomeng.com/web/

Future considerations for a HTML5's 'pointerevents' API generically supporting pressure, angle and touch events for all tablet types are proposed here.

http://www.w3.org/TR/pointerevents/

like image 41
eriksssss Avatar answered Oct 19 '22 17:10

eriksssss


There is no API specific to a stylus which supports things like pressure-sensitivity or orientation. But in most cases a stylus can be used as a mouse. In this case it will create normal mouse events like mousedown, mousemove and mouseup. You can add event handlers for these events to your canvas and react to them appropriately.

like image 27
Philipp Avatar answered Oct 19 '22 17:10

Philipp