carstenschaefer / DrawerJs

A customizable WYSIWYG HTML canvas editor.
https://www.drawerjs.com
MIT License
556 stars 113 forks source link

Standalone DrawerJS using API touch pen issue #63

Open brianm85 opened 3 years ago

brianm85 commented 3 years ago

Using the API example, it doesn't allow the pen from a touch device to draw, only a mouse. Am I missing a config setting or is it designed this way

artmediaweb commented 3 years ago

Same question... EDIT : i think it's a question of coordinates captured on touch : if i put the canvas div "up" on the body (by hidding previous divs in the api exemple page), it works...

MatthewHolmes commented 3 years ago

Anyone had any luck correcting this? Seems to be an issue on the iPad Pro using an Apple Pencil.

hawelkam commented 1 year ago

I know the issue is old but maybe this will help you. Had the same issue with pencils on Windows Tablets. It seems to be an issue with fabric. You need to add one check in fabric.1.7.22.min.js for isTouchSupported - navigator.maxTouchPoints > 1

fabric.isTouchSupported="ontouchstart" in fabric.document.documentElement||navigator.maxTouchPoints>1;

Remember to save without formatting so the minified file stays minified.

This helped us in our app, hopefully it will work for you as well ;)