ngl icon indicating copy to clipboard operation
ngl copied to clipboard

Hoverpick event is fired only after a touchmove event is fired

Open giagitom opened this issue 5 years ago • 7 comments

Hi, when on a touchscreen I have the focus on an external element and than I try to hoverpick inside the viewer, the event is not fired. To restore the behavior, I have to fire a touchmove event before, and then the hoverpick event is fired normally.

giagitom avatar Mar 28 '19 14:03 giagitom

I don't quite understand, could you elaborate?

arose avatar Apr 26 '19 16:04 arose

I noticed this behavior on mobile devices (iPad in particular) . For example consider default hoverpick event showing the tooltip when hovering over atoms. Now, if I have the focus on something different from the canvas, and I try to make a touch gesture to trigger the hoverpick event, the event isn't triggered. But instead, the hoverpick event is triggered if I touch+drag changing the view before.

giagitom avatar Apr 26 '19 16:04 giagitom

Also the clickpick event is not fired at the same way

giagitom avatar Apr 26 '19 17:04 giagitom

Is this specifically an NGL issue, or is this general behaviour with canvas objects when they lose focus?

fredludlow avatar Jun 10 '19 10:06 fredludlow

Hi @fredludlow , I don't think so. I tried to set the focus on canvas with javascript before making the first touch gesture but the problem persists. Also this happens not only the first time I make the touch gesture, but it keeps happening until a touch+drag event is fired.

giagitom avatar Jun 10 '19 10:06 giagitom

Testing with my browser's mobile emulation, I can reproduce this. The hover events only get fired on a touch move, not the initial touch, and the click pick is never fired. This matches exactly what I see in the code - only the _onTouchmove function fires the moved and dragged signals which are responsible for initiating the hover pick (for mouse it makes sense to only do this on move, as it's a hover action), and the _onTouchend function fires no events.

This raises a question though: On a mobile device, which has no hover behavior, how should this work? Only fire the click event? Or maybe fire the hover event if it's a long-press but click if it's a short press? I've seen the latter, though I've also seen a long press equate to a right click.

I'd like to make a PR to address this, any thoughts?

luxaritas avatar Jan 20 '22 23:01 luxaritas

I opt for a long press to fire the hover event. It seems more intuitive to me.

giagitom avatar Jan 21 '22 01:01 giagitom