diff --git a/docs/API.md b/docs/API.md index 6e3fe7e..f5be1bc 100644 --- a/docs/API.md +++ b/docs/API.md @@ -24,6 +24,8 @@ For the logical field / visual widget data model (plain serializable types, rela | `ignoreClickOutsideSelectors` | Array | `[]` | CSS selectors that keep the selection active when clicking outside the element | | `pageCountFormat` | String | `'{currentPage} of {totalPages}'` | Format string for page counter | | `autoFitZoom` | Boolean | `false` | Automatically adjust zoom to fit viewport on window resize | +| `showThumbnails` | Boolean | `false` | Show a sticky thumbnail sidebar on the left; clicking a thumbnail calls `goToPage` and the current page is highlighted | +| `thumbnailWidth` | Number | `120` | Thumbnail width in pixels | | `pdfjsOptions` | Object | `{}` | Options passed to PDF.js `getDocument` | ## PDF.js options @@ -44,10 +46,13 @@ For the logical field / visual widget data model (plain serializable types, rela - `pdf-elements:end-init` - Emitted when PDF is loaded. - `pdf-elements:adding-ended` - Emitted when interactive placement ends. Payload: `{ reason: 'placed', object, docIndex, pageIndex }` on success or `{ reason: 'cancelled' }` when placement is cancelled. +- `pdf-elements:page-change` - Emitted when the page occupying most of the viewport changes (on scroll and after load). Payload: `{ docIndex, pageIndex }` (zero-based). ## Exposed methods - `startAddingElement(templateObject)` - Starts interactive placement mode. +- `goToPage(pageIndex, docIndex = 0)` - Scrolls the page to the top of the viewer. Zero-based indices. Returns `false` when the page does not exist or is not rendered. +- `getCurrentPage()` - Returns `{ docIndex, pageIndex }` for the page occupying most of the viewport, or `null` when no page is rendered. - `cancelAdding()` - Cancels the current placement session and emits `pdf-elements:adding-ended` with `{ reason: 'cancelled' }` when a session was active. ## Slots diff --git a/src/components/PDFElements.vue b/src/components/PDFElements.vue index 28e6a2e..c8b5317 100644 --- a/src/components/PDFElements.vue +++ b/src/components/PDFElements.vue @@ -4,7 +4,15 @@ SPDX-License-Identifier: AGPL-3.0-or-later -->