Extensions
Extensions allow you to add custom functionality, content types, and UI controls to VistaView.
Extension Types: See Types for:
- VistaExtension - Extension interface
- VistaDefaultCtrl - Built-in control names
- VistaImageParams - Parameters for
onInitializeImage
Creating Extensions
Section titled “Creating Extensions”Extensions implement the VistaExtension interface with optional hooks:
name(required) - Unique identifierdescription(optional) - Human-readable descriptioncontrol()(optional) - Returns custom UI control elementonInitializeImage()(optional) - Replace default image creationonImageView()(optional) - Triggered on navigationonContentChange()(optional) - Triggered on content/zoom changesonDeactivateUi()/onReactivateUi()(optional) - UI control stateonOpen()/onClose()(optional) - Lightbox lifecycle
Extension Example
Section titled “Extension Example”Simple logger extension:
Control Configuration
Section titled “Control Configuration”Example:
See VistaDefaultCtrl for built-in control names.
Advanced Classes
Section titled “Advanced Classes”These classes are exported for advanced use cases:
VistaBox
Section titled “VistaBox”Base class for content containers. Extend this to create custom content types.
Other Classes
Section titled “Other Classes”- VistaView - Main view controller class (available in all callbacks)
- VistaState - State management (accessible via
vistaView.state) - VistaBox - Base class for content containers
- VistaImage - Individual image instance (extends VistaBox)
- VistaPointers - Multi-pointer tracking system (see VistaPointer)
- VistaImageEvent - Event handling system
- VistaHiresTransition - High-resolution image transition manager
Utility Functions
Section titled “Utility Functions”parseElement
Section titled “parseElement”Parses a DOM element or image config into parsed element data.
Complete Extension Example
Section titled “Complete Extension Example”Custom download button extension: