ngx-gallery icon indicating copy to clipboard operation
ngx-gallery copied to clipboard

Replace hammerjs with native touch events

Open vpetrusevici opened this issue 2 years ago • 16 comments

What is the expected behavior?

Use native pointermove event instead of outdated hammerjs.

What is the current behavior?

We should install and use hammerjs to enable touch events.

What is the use-case or motivation for changing an existing behavior?

Possibility to avoid additional dependency.

Is there anything else we should know?

I can try to implement it if you agree.

vpetrusevici avatar Aug 03 '22 08:08 vpetrusevici

It also can be just another tree-shacking library like this one https://github.com/nolimits4web/swiper

vpetrusevici avatar Aug 03 '22 08:08 vpetrusevici

Yes, you can try, PRs are welcome!

MurhafSousli avatar Aug 03 '22 10:08 MurhafSousli

Added a draft PR as PoW

vpetrusevici avatar Aug 09 '22 22:08 vpetrusevici

@vpetrusevici Thanks, I will have a look!

MurhafSousli avatar Aug 10 '22 02:08 MurhafSousli

@MurhafSousli I finished all related work. Hope I didn't miss any features

vpetrusevici avatar Aug 12 '22 16:08 vpetrusevici

Hi, @MurhafSousli Sorry to bother you, but could you please check my PR?

vpetrusevici avatar Sep 23 '22 14:09 vpetrusevici

@vpetrusevici an update on this issue... version 8 removed the usage of HammerJs for mobile sliding! it does not use the native touch events either! it is now using the native scrolling to slide the gallery!

However, HammerJs is still used BUT only for sliding on desktop browser using the mouse.

Feedback is appreciated https://github.com/MurhafSousli/ngx-gallery/releases/tag/v8.0.0-beta.1

MurhafSousli avatar Oct 27 '22 04:10 MurhafSousli

Thank you! I'll test it :)

vpetrusevici avatar Oct 27 '22 06:10 vpetrusevici

Hi! I notice some update promlem in gallery thumbs https://1drv.ms/u/s!ArDpOrDSusKbvyki94glg5pxuZNB?e=h3S3aK

vpetrusevici avatar Oct 27 '22 19:10 vpetrusevici

Should be fixed in v8.0.0-beta3

MurhafSousli avatar Oct 28 '22 20:10 MurhafSousli

It's working well in a lightbox, but in a simple gallery the problem still exists. I think the problem in the async pipe. You can try to use this variant https://github.com/MurhafSousli/ngx-gallery/pull/483/files#diff-b9348fa0028b29ce8458b889a0dbfa72d9b766f99e4666c57e9392a5de5c7012 It should subscribe outside of ngZone and execute changes in ngZone

vpetrusevici avatar Oct 29 '22 12:10 vpetrusevici

The problem is with the gallery size, if the gallery's width value has fraction e.g. 500.63px, then it will have this issue, but with the latest fix, I forced the gallery to have a fixed size value

MurhafSousli avatar Oct 29 '22 16:10 MurhafSousli

I tried with beta4. The same behaviour

vpetrusevici avatar Nov 01 '22 18:11 vpetrusevici

Tested on mobile. Here looks good

vpetrusevici avatar Nov 07 '22 10:11 vpetrusevici

Can you test it with beta5?

MurhafSousli avatar Nov 27 '22 05:11 MurhafSousli

I tested in chrome and android. Looks good. Only 1 bug found for SSR https://github.com/MurhafSousli/ngx-gallery/issues/532

vpetrusevici avatar Mar 28 '23 19:03 vpetrusevici