Riron / ionic-img-viewer

Ionic 2+ component providing a Twitter inspired experience to visualize pictures.
MIT License
283 stars 118 forks source link

Need to trigger the viewer from code #65

Closed mdwekat closed 7 years ago

mdwekat commented 7 years ago

Some times I need to access the image viewer form the code because the I might have some deferent logic when clicking on the image for example I want to make sure that the user can access the large image so I need to use click event and do my check then start the image viewer.

I see no provider or any api to the image viewer. can you please let me know what to do.

Thanks

QXCgxNED commented 7 years ago

I'd like to add my voice to this. I am using image viewer inside Ionic Slides component. Slides are for browsing an image gallery, and image viewer is for zooming into an image.

I would also like to be able to open image viewer on click, because I am stuck with the default configuration. For example, I do not like having to swipe up to close the viewer. I would prefer users to tap to go in, and also to tap to go out. But this cannot be changed without source code edited. And probably other people prefer to swipe up, so it's not an option. It has to be configurable.

If image viewer would be opened using onClick event, then in addition to the URL parameter we could also specify the "options" parameter. And in the options it could be anything: behaviour, colours, you name it, we could expand it indefinitely.

The image viewer is great, thank you Riron. It's probably the best I've tried so far, and supports both mobile and desktop. But it's too rigid at the moment, it needs an easy way to be configured and extended.

Using onClick event and options parameter is one way to do it, if there's a better way I'm all for it too.

Riron commented 7 years ago

Thanks for sharing your thoughts @QXCgxNED. Opening the viewer on click is nearly ready and will be available soon.

Nevertheless I am not planning on supporting "click to close" right now, as I'm not sure that's the best UX. This plugin is inspired by what we use on apps like Twitter and Facebook, and clicking on an image to go back in the history doesn't feel natural to me.

So yes the plugin will become more flexible with this way of opening it, but I want to avoid adding too many options as it may confuse users.

Of course, you can always fork it and tweak some bits to better suit you needs !

Anyway, thanks for you support, and i'm glad you like it ! 👍

Riron commented 7 years ago

Closing this issue as it landed in ionic-img-viewer@2.4.0.

QXCgxNED commented 7 years ago

Thank you for taking time to reply to me. I hope it's just a misunderstanding, because I did not ask to support any feature like "click to close". I was suggesting to provide other developers a possibility to easily extend the functionality. Some people like Twitter, that's fine, but other people like other things. There should be some team work here. Limiting other engineers to the implementation that is only suitable for someone is not the way collaboration works. Giving people freedom to extend and configure is the way to go. Adding more options is not confusing if done in clear and documented way. More options means more freedom to use your software the way people like. And people like very different things, and have very different use cases. Better to let them decide for themselves, and give them an easy way to contribute.

Riron commented 7 years ago

I'm not sure to understand what you would like then. Isn't it a new option to close the viewer on click ?

And I am open for suggestions to "provide other developers a possibility to easily extend the functionality" ! Just open a new issue if you have any idea, thanks 😄

mdwekat commented 7 years ago

Thank you for taking the time and the effort to implement the controller. it works perfectly! 😄