Skip to content

Events in Mirador

Jack Reed edited this page May 19, 2020 · 1 revision

Increasingly, Mirador is taking advantage of the publish-subscribe pattern to provide information about the current state of Mirador, often changed through actions by the user.

This pub/sub pattern can be used in adding new functionality in Mirador, as well as from external applications that developers wish to have interact with Mirador.

Published events in Mirador (Work in Progress)

Event Name Arguments Description
annotationCreated.[WindowID] Annotation as OA, OpenSeadragon Overlay When a user clicks to save an annotation, publish the Open Annotation and its corresponding overlay element so that it can be saved to the annotation store
annotationDeleted.[WindowID] Annotation ID When a user clicks to delete an annotation, publish the annotation identifier so it can be removed from the annotation store
annotationEditorAvailable.[WindowID] None Indicate that the Rich Text Editor for annotations is initialized and ready
annotationListLoaded.[WindowID] None Publish every time Window's master annotation list is changed (through create, update, delete, search, etc)
annotationUpdated.[WindowID] Annotation as OA When a user clicks to save an existing annotation, publish the new Open Annotation so it can be saved to the annotation store
bottomPanelSet.[WindowID] Boolean indicating visibility Indicates current visibility of the bottom panel
catchAnnotationsLoaded.[WindowID] Array of CATCH annotations Publishes the CATCH-formatted list of annotations for a canvas after a successful search
catchAnnotationDeleted.[WindowID] Annotation ID Publishes the id of the annotation that was deleted from the CATCH store
catchAnnotationUpdated.[WindowID] CATCH annotation as JSON Publishes the CATCH-formatted annotation after a successful save
catchAnnotationCreated.[WindowID] Response from CATCH as JSON Publishes the CATCH-formatted annotation after a successful save
currentCanvasIDUpdated.[WindowID] Current Canvas ID When a user selects a new canvas, publish its id
disableRectTool.[WindowID] None Disable annotation drawing
disableTooltips.[WindowID] None Disable tooltip display through mouse over
enableRectTool.[WindowID] None Enable annotation drawing
enableTooltips.[WindowID] None Enable tooltip display through mouse over
fitBounds.[WindowID] x, y, width, height Dynamically set the OSD bounds to zoom/pan to specific locations on the canvas, e.g. Mirador.eventEmitter.publish('fitBounds.[WindowID]', {'x': 0, 'y': 0,'width': 750, 'height': 500});
focusUpdated None Indicate that a focus in any window has changed
imageBoundsUpdated { WindowID, OpenSeadragon Bounds } When the OpenSeadragon canvas has been panned or zoomed, publish the new OSD bounds and the associated window ID
imageRectangleUpdated { WindowID, x,y,width,height as Image Pixels } When the OpenSeadragon canvas has been panned or zoomed, publish the new OSD bounds in image pixels and the associated window ID
layoutChanged Layout Publish when the layout of windows has changed (by adding/removing a slot, or creating a grid of slots)
manifestPanelWidthChanged width Publish when the browser window has been resized, causing a change in the width of the manifest gallery
manifestQueued Manifest as JSON, Repository Location Publish when a manifest has been requested, but has not yet been received
manifestReceived Manifest as JSON Publish when a manifest has been successfully received
manifestListItemRendered Publish when a manifest list item has been rendered
modeChange.[WindowID] Annotation Mode - one of ['displayAnnotations', 'editingAnnotations', 'default'] Published when the annotation mode has changed, usually by clicking the different buttons in the annotation menu
osdOpen.[WindowID] None Publish when the OpenSeadragon object has opened
overlaysRendered.[WindowID] None On rendering of all annotation overlays in OpenSeadragon
removeOverlay.[WindowID] Annotation ID After successful deletion of an annotation, indicate that its corresponding overlay can now be removed, using its id
saveControllerConfigUpdated None Indicate that the SaveController configuration has changed
tooltipViewerSet.[WindowID] None Indicate that the content for the tooltip to view an annotation has been set
updateAnnotationList.[WindowID] None Forces the annotation list for a window to be refreshed
windowAdded { WindowID, Slot address } A new window has been added with a given identifier and slot address
windowRemoved WindowID of Removed Window A window has been removed from the layout, passing the id of the deleted window
windowSlotAdded { WindowID, Slot address } A slot for a window has been added
windowSlotAddressUpdated { WindowID, Slot address } The slot address for a window has been updated, due to a layout change
windowUpdated { WindowID, state of a specific window option } Indicates a specific configuration in the window has changed
removeTooltips.[WindowID] None Publish that existing annotation tooltips should be removed, usually due to a change in the canvas ID