MurhafSousli / ngx-gallery

Angular Gallery, Carousel and Lightbox
https://ngx-gallery.netlify.app/
MIT License
597 stars 126 forks source link

Suggestions for Two Additional Thumbnail Features #591

Open tvsbrent opened 7 months ago

tvsbrent commented 7 months ago

What is the requested behavior?

(Sorry for tweaking the template / leaving some sections empty, hopefully that's ok!)

I was wondering if you'd accept pull requests for the following new features for thumbnail navigation in the Gallery. I'm willing to do the work, but wanted to ask for your thoughts before beginning such work.

What is the current behavior?

n/a

What are the steps to reproduce?

n/a

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

Explained above.

Which versions are you using for the following packages?

Angular: 16.1.1 Angular CDK: 16.1.1 Angular CLI: 16.1.0 Typescript: 5.0.4 Gallery: 11.0.0

Is there anything else we should know?

n/a

MurhafSousli commented 7 months ago

The wheel already work natively since it's a scrollable layout, however, for horizontal scroll you need to press shift while scrolling. I am not sure if there is a native way to make it work without the shift.

The problem with the wheel event that it ruins the the touchpad horizontal scroll as in this example https://dev.to/juanbelieni/how-to-create-horizontal-scroll-with-mouse-wheel-using-javascript-4cm5

The way I would prefer such addition is if we make it work by applying an external directive on the gallery and avoid adding the logic inside the component itself. I would hold on until next version.

For the second feature, it is on my radar, however for this to work we have to implement a pagination feature in the gallery.

I have implemented this in another abandoned carousel plugin I never released Check the demo here and here and try to slide the thumbnails.

The galleryRef state would like:

export interface GalleryState {
  total?: number;
  perPage?: number;
  hasNextItem?: boolean;
  hasPrevItem?: boolean;
  activeItem?: number;
  activePage?: number;
  pages?: CarouselItem[];
}

For example you set perPage to 5, which means 5 items per page (slide).

You can navigate by item, or by page. I think when this is implemented we can easily add the secondary nav on thumbnails

BTW, I am releasing a beta version which I am currently working on in this branch https://github.com/MurhafSousli/ngx-gallery/tree/next, if you want to try out it use the storybook npm task to run the project