artursapek / mondrian

Web-based vector graphics editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails to recognize tablet pen tip "click" input.

Fishrock123 opened this issue · comments

Ok so, this isn't about full tablet support. That would only be available via a plugin / extension.

I have an Intuos5 Digitizer tablet, and mondrian is not recognizing the click/mouseup event from the pen tip.

Funnily enough, the eraser tip works perfectly.

Hahah. It seems like a hardware problem. Does the tablet's pen tip act as a mouse on other websites? I used to have an Intuos and I remember the computer just thinking it was a mouse.

Yes, without a special extension to the browser, it will.

I have been fooling around with event listeners for the past couple minutes and it seems to be recognized as a normal mouse.

I have no idea, sorry. Don't have a way to try it myself.

If you figure out the problem you could fix it and open a PR. The code having to do with the cursor is here. It's a class that keeps the state of the cursor to achieve things like dragging and double-clicking. I may have done something to break your tablet there, but again if the computer just thinks it's a mouse I don't understand what would cause your mouse to work and your tablet to not.

Ok, I'm pretty sure a lot of this issue is caused by wonky double-click support. Still investigating.

Edit: Nope, it's the drag support that is messing with it.

An "easy" way to deal with this may be to disable drag support unless the tool uses it.

How do you know it's the drag support? Were you able to fix it by disabling some code?

Dragging blocks clicks, and logging showed it was firing drag events.

This could probably be fixed by widening the minimum drag distance, or something.

Oh, I get it. Yes. "Clicks" in Mondrian are:

  1. Mouse down
  2. Mouse up iff the mouse has not changed position

So your problem is it's hard to push down with a stylus without moving it at all.

I think you're right on. A minimum drag distance (2-3px) could help for tools that don't require dragging. You could also implement a slightly higher threshold for tools that don't need dragging.

This would obviously take some testing and adjusting. Since you're the one with the Intuos, if you get something working that feels good to you, I'd love to see it in a PR. :)

On my Sprint Samsung Note 2, I can open the webpage, open menu items, select boxes on the left, but can not 'draw'.

You need to drag to draw, and dragging on phones is scrolling. There might be a way to get around this with JavaScript, but I don't have a tablet to test on yet.