svg.panzoom.js icon indicating copy to clipboard operation
svg.panzoom.js copied to clipboard

When oneFingerPan is true clicks on SVG elements are not working anymore

Open meriturva opened this issue 4 years ago • 13 comments

is it possible to enable oneFingerPan and still receive mouse events from SVG elements?

Thanks

meriturva avatar Dec 20 '21 08:12 meriturva

Mh, this is not that easy to solve. Some people want to be able to pan even if you "start" the pan on an element. You however dont want panning on elements. I am not really sure how to satisfy both

Fuzzyma avatar Dec 20 '21 09:12 Fuzzyma

I guess the only way is a sort of timeout handling and move difference between mouseDown and mouseUp event. What do you think?

meriturva avatar Dec 20 '21 09:12 meriturva

That will complicate the code quite a bit and timeouts are really sensitive to race conditions and stuff not behaving the same all the time. Thats why I avoid them. btw: what mouse events exactly are not working for elements anymore? Afaik, we don't stop Propagation and only prevent default for touch down

Fuzzyma avatar Dec 20 '21 11:12 Fuzzyma

Seems to be blocked globally, I could prepare a simple repo to play with.....what do you think?

meriturva avatar Dec 20 '21 11:12 meriturva

sure there is no harm in playing around and finding better solutions

Fuzzyma avatar Dec 20 '21 12:12 Fuzzyma

Here a simple stackblitz with oneFingerPan enabled: https://stackblitz.com/edit/js-ulebap?file=index.html

Please use a touch screen or a device to test click.

As you could see there is no way to make click works on the top black dot.

meriturva avatar Dec 20 '21 13:12 meriturva

Works for me when doing this:

  SVG('#pointB').on('click', () => {
    console.log('test');
  });

Fuzzyma avatar Dec 20 '21 19:12 Fuzzyma

Thanks @Fuzzyma for your time but when I try your sample on my touch screen I have the same issue. Did you try on a touch device? if yes on a desktop touch display or mobile one?

meriturva avatar Dec 20 '21 19:12 meriturva

No. I only tried on my laptop. You can try touchstart as well tho. Sorry, I cant spend much time to figure this out atm.

Fuzzyma avatar Dec 20 '21 20:12 Fuzzyma

@meriturva got the same issue. found any solution for this?

dmitriyzhuk avatar Jan 17 '22 08:01 dmitriyzhuk

@meriturva got the same issue. found any solution for this?

No actually

meriturva avatar Jan 17 '22 13:01 meriturva

Have the same issue is there a proper solution for this?

Quasarman avatar Aug 12 '23 21:08 Quasarman

Would be nice if a threshold could be configured. Something like "if I drag my finger for 5px, then it starts to pan, otherwise it's a click".

phrei avatar Sep 13 '23 06:09 phrei