Open
Conversation
cf68d97 to
cdf6b48
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request partially addresses the feature request submitted on readium/mobile#10.
This PR adds
TargetElementmetadata toPointerEvent, enabling apps to detect when the user interacts with an image element(<img>,<svg>) and access its frame, source URL, and alt text. The TestApp demonstrates this with a fullscreen image preview viewer.Navigator changes
extractTargetElement()ingestures.jsthat extracts metadata (boundingrect,tag,src,alt) from the nearest image element under the pointer. AddedfindNearestImageElement()to walk up the DOM tree.PointerEvent.TargetElement: New struct withtag,src,alt, andframeproperties, available on every -PointerEvent. The src URL is relativized against the publication base URL so it can be used directly withPublication.get().TestApp demo
ImagePreviewViewController— fullscreen image viewer with UIScrollView-based pinch-to-zoom (1x–4x).ImagePreviewTransition— custom spring-based animated transition from the image's in-page position to centered aspect-fit, and back on dismiss.ImagePreviewNavigationController— wraps the preview and owns the custom transitioning delegate.Wired via a
.tapobserver inVisualReaderViewController.Design decisions
<img>and<svg>) — Video and audio elements don't benefit from a zoom preview, so detection is limited to image tags to keep the implementation focused.InputObservingAPI, which can be used to detect double-tap, pinch, and other gestures. Rather than adding dedicated gesture events, this PR exposesTargetElementmetadata onPointerEvent, giving apps the building blocks to implement custom gesture handling on top of the existing API.Previews
iphone.mov
ipad.mov