hyperoslo / Lightbox

:milky_way: A convenient and easy to use image viewer for your iOS app
https://www.hyper.no
Other
1.62k stars 326 forks source link

Add tap delegate for tap/double tap detection #293

Closed dknchris closed 1 year ago

dknchris commented 1 year ago

A reliable tap event helps users hide/unhide navigation bar or toolbars to give a full unobstructed view of the image.

dknchris commented 1 year ago

LightboxControllerTapDelegate essentially replaces LightboxControllerTouchDelegate for a few reasons:

  1. LightboxControllerTouchDelegate function is called when we 'tap' the page and not really every time we 'touch/drag'. Hence a function with didTap makes more sense with the newLightboxControllerTapDelegate.
  2. LightboxControllerTouchDelegate didTouch function isn't fired when the image is zoomed making it impossible to show/hide navigation bar or a toolbar when we tap a zoomed image. This is fixed by the new delegate which supports both tap/double tap events regardless of the zoom state. This is exactly what is done in iOS Photos app.

But removing LightboxControllerTouchDelegate is obviously a breaking change so we could either keep both the touch and the tap delegates and deprecate touch delegate until a major revision.

Also, thank you for your work!

3lvis commented 1 year ago

Thank you for your contribution, @dknchris!