mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Touch gestures for fixed-layout: pinch-zoom, pan, swipe paging, double-tap
- Single finger: pan while zoomed; horizontal swipe pages at fit (direction mapped through next()/prev() so RTL manga reads correctly); drag on PDF text still defers to selection via the existing smart-detection (realTarget). - Two fingers: pinch-zoom around the midpoint (through the shared zoom machinery, so PDF re-render scheduling works) plus midpoint-pan; lifts back to single-finger pan when one lifts. - Double-tap: zoom 2.5x at the point / reset to fit. - Touch events forwarded from page iframes with converted coordinates; preventDefault only when the engine actually consumes the gesture so native selection/taps stay intact. - touch-action: none on :host and in comic/pdf page documents so the browser does not fight the gesture engine inside iframes.
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ export const makeComicBook = ({ entries, loadBlob, getSize }, file) => {
|
||||
if (cache.has(name)) return cache.get(name)
|
||||
const src = URL.createObjectURL(await loadBlob(name))
|
||||
const page = URL.createObjectURL(
|
||||
new Blob([`<!DOCTYPE html><html><head><meta charset="utf-8"></head><body style="margin: 0"><img src="${src}" style="image-rendering: high-quality"></body></html>`], { type: 'text/html' }))
|
||||
new Blob([`<!DOCTYPE html><html><head><meta charset="utf-8"></head><body style="margin: 0; touch-action: none"><img src="${src}" style="image-rendering: high-quality"></body></html>`], { type: 'text/html' }))
|
||||
urls.set(name, [src, page])
|
||||
cache.set(name, page)
|
||||
return page
|
||||
|
||||
Reference in New Issue
Block a user