Image component integration - #219
Conversation
# Conflicts: # resources/js/edirom-verovio-renderer
Veroviointegration
…ageId to showImage
…ure not showing with high measure count
|
I will hopefully be able to review this in the coming days. At a first glance I saw that the Image Viewer still references the very old 4.1.1 OpenSeaDragon version. Is there a reason for that? Also, I think we should deliver this web component with the static minified file of the most recent OpenSeaDragon version in a |
|
Also there is a dependency on |
|
I opened two Pull Requests to the Image Viewer Component: |
|
anks @DennisFriedl for the comments and the PRs. I used the old OpenSeadragon version because I continued working from the old Edirom code; there was no particular reason behind it. I've approved your PRs. I also think it's feasible and better to use the edirom-icon component instead of FontAwesome. I've created an issue for it here: #271 |
|
Thank you, @hizclick . Controllers
Views
Could we maybe take the integration of this Web Component as an opportunity to tidy things up and to "merge" logic together (where it makes sense) for a more unified "Image Viewer" in Edirom? |
|
I have created these PRs for issue #271 |
Thanks @DennisFriedl , that's a good point, and I agree it could be a good opportunity to tidy this up further. I will take a closer look at the controller/view split across For now, as part of the current OpenSeadragon integration work: Given the code freeze on September 7, I will take a look at this before then and see how much of the broader consolidation is realistic to fit in ahead of it. |
…r.js since the diglib logic is now included in OpenSeaDragonViewer.js
|
.
So the idea, as I understand it, is to reduce the "Image Viewer" from being reimplemented independently across every window type to a single widget ( The plan would be
|
|
I am not an OpenSeaDragon expert but could the |
It could, will check it out |
Following up on this, I looked into it, and I don't think it makes sense to switch MeasureBasedView to multi-image right now. Multi-image is OpenSeaDragon's built-in support for loading several tile sources into one shared viewer/world, positioning each with That said, for relevance elsewhere, it could still make sense to extend the component itself to support multi-image as a general capability, so it's available whenever a future use case (e.g. multi-source reconstructions) |
|
Opened PR #276 to extract the duplicated ImageViewer host-side setup into a shared ImageViewerHost.js helper. |
Integration of the
edirom-image-viewerweb componentDescription, Context and related Issue
This PR integrates the new OpenSeadragon-based
edirom-image-viewerweb component into the Edirom Online Frontend and rewires the existing ExtJS image window to drive it. It replaces the previous tightly-coupled OpenSeadragon usage with a reusable, attribute-driven custom element (rendered in its own Shadow DOM), so the facsimile viewer can be developed and reused independently of the ExtJS application.The result is a clean split of responsibilities: the component owns all viewer rendering (tiles, pagination, and every overlay — measures, measure labels, movements, annotation badges, and their tooltips), while ExtJS only provides data and the surrounding window UI. The host communicates with the component purely through attributes and custom events — no direct OpenSeadragon API calls remain in the ExtJS layer.
What this PR delivers:
resources/js/edirom-image-viewer/): a self-containededirom-image-viewer.jscustom element built on OpenSeadragon, with IIIF manifest / tile-source loading, sequence & collection modes, zoom/pan/rotation, configurable native controls, and a fully attribute-driven API plus custom events. Includes component metadata (README.md,LICENSE,CITATION.cff,CODE_OF_CONDUCT.md). The component is included as a git submodule.OpenSeaDragonViewer.js): the ExtJS image viewer now instantiates the custom element and communicates with it purely through attributes/events instead of direct OpenSeadragon API calls — keeping all viewer state (page, zoom, rotation, controls) in sync with the surrounding Edirom UI (page spinner, top bar, source views).zones-dataoverlay model: every overlay type — annotations, measures, measure labels, and movements (mdivs) — is now pushed through onezones-datamap keyed by a namespaced zone key (measure:<key>,mdiv:<key>,annotation:<…>). Each zone entry carries itstype, optionalpage, rectangle (ulx/uly/lrx/lry), CSS classes (containerClass/innerClass), an optionallabel, agroup(so badges on the same region stack), a preloadedtooltipHTML, a clickfn, and genericfilterstokens. Each sub-map (measures / mdivs / annotations) is merged on its own push, so re-pushing one type never drops the others. This replaces the former separatemeasures-data/mdivs-data/annotations-data/measure-numbers-dataattributes.zonenavigation attribute: navigation to any zone (a bar, a movement, or a generic region) goes through the single semanticzoneattribute, set to the namespaced key with an optional|<nonce>token so repeated jumps to the same key re-fire. Same-page jumps fit the region directly; cross-page jumps switch page, wait for tiles, then fit — enabling the source / concordance views to jump the facsimile to a specific bar or movement, including across pages. Wired throughPageBasedView/MeasureBasedView/SourceView.annotation-typed entries inzones-data; the component renders the clickable badges in its Shadow DOM and fires azone-clickevent back to the host for the click action. The annotation tooltip is rendered by the component itself from a per-zonetooltipHTML field — the host preloads each annotation's server-rendered tooltip HTML up front (fetched in parallel, with a safety-net timeout) and pushes it intozones-data, and the relevant edition / overlay CSS is injected into the Shadow DOM so the tooltip is styled correctly.visible-types: whole overlay types are shown/hidden through thevisible-typesattribute (a JSON array of the zone types to render, e.g.["annotation","measure"]), without discarding the pushedzones-data. This is a pure visibility switch (no re-fetch / re-push) and replaces the former per-featureshow-annotations/show-measure-numbersbooleans.hidden-filters(two-way sync): category & priority filtering now uses a single generichidden-filtersset — the union of the taxonomy tokens the user has unchecked; the component hides any annotation carrying one of them. "No filter" is the empty set and "hide all" is every token, so the old["undefined"]/[]sentinels and the separatevisible-categories/visible-prioritiesattributes are gone. The component emits afilter-changedevent (carryingdetail.hiddenFilters) whenever the filter changes — including whenhidden-filtersis set externally (e.g. via DevTools) — so the host keeps its filter-menu checkboxes in sync with no feedback loop.labeland label CSS class (measureInner/measureInnerEmpty), and they show/hide with themeasuretype viavisible-types, re-applied on every page render.total-pages-changedevent when its tile-source set shrinks (e.g. a page is removed), so the host trims its page list / spinner bounds and notifies the owning view.setZoomnow clamps to[minzoomlevel, maxzoomlevel]— fixing zoom-bar overshoot beyond the configured maximum and jump/zoom spring-back.setFullScreento use the standard Fullscreen API on the component host element.view-mode: the active source view mode is pushed to the component via theview-modeattribute so host code can react.README.mddocuments all attributes (incl.preserveviewport,minzoomlevel,maxzoomlevel,zones-data,zone,visible-types,hidden-filters,fitrect,triggerhome,sequencemode,view-mode), public methods, events (page-changed,total-pages-changed,zone-click,filter-changed,zoom,image-ready), and the "Zones", "Region Navigation" and "Annotation Overlays" guides.Refs #12
How Has This Been Tested?
Tested locally with the full Edirom Online stack via Docker Compose, building the frontend from this branch against the
developbackend:Manual verification in the running app (eXist-db at
localhost:8080, app at/exist/apps/Edirom-Online-Frontend/):true) loads a single page item and collection mode (false) loads all images. Removing a page firestotal-pages-changedand trims the host page list / spinner.zones-data, then triggerzone="measure:<key>|<nonce>". Verified both same-page and cross-page jumps firepage-changedand fit the region aspect-correctly and centered (e.g. a measure on page 2 with rect1170,240 → 1360,1180).zones-dataand triggerzone="mdiv:<key>|<nonce>"to jump to a movement's first page; verified correct page/movement navigation from the source views.maxzoomlevel=5,setZoom(10)clamps to 5; withminzoomlevel=0.5,setZoom(0.01)clamps to 0.5; no jump/zoom spring-back.zones-data(each carrying itstype:'annotation', rect,innerClass, preloadedtooltipHTML, clickfn, andfilterstokens) and make them visible viaviewer.setAttribute('visible-types', '["annotation"]'); the badge renders, hovering shows the component-rendered tooltip (styled via the injected CSS), and clicking fireszone-clickso the host runs the action.visible-typesbetween["annotation","measure"]and[]shows/hides whole overlay types without re-pushingzones-data, and the chosen state persists across page changes.hidden-filters):viewer.setAttribute('hidden-filters', '["ediromAnnotPrio1"]')hides annotations carrying that token;'[]'shows all. Setting the attribute externally re-checks/unchecks the matching host menu items via thefilter-changedevent, with no feedback loop.labelrender the numbered box and empty ones usemeasureInnerEmpty; visibility follows themeasuretype invisible-typesand persists across page changes.zone="",visible-types="[]",hidden-filters="[]",view-mode=""produces no console warnings.Types of changes
Overview