Installation
This plugin requires its stylesheet. Import
@photo-sphere-viewer/settings-plugin/index.css or add the CDN link to your <head>.Usage
Adding a setting
CalladdSetting() on the plugin instance. There are two setting types.
Toggle setting
A toggle has only two states:true and false. Provide active() and toggle() callbacks.
Options setting
An options setting has multiple values. Providecurrent(), options(), and apply() callbacks.
Both
label values accept a key from the main viewer lang object for translation purposes.Button badge
A setting can expose abadge function whose return value is shown as a badge on the settings button itself. Only one setting can declare a badge at a time.
Configuration
Persist setting values across sessions using the configured
storage. Not updatable after init.Custom storage backend for persisting settings. Provide Compatible with LocalForage, NgRx, a custom HTTP service, or any async key-value store.
get and set methods. Not updatable after init.Localization strings merged with the main viewer
lang object.Events
setting-changed
Triggered when a setting value changes.
Navbar buttons
This plugin adds one button to the default navbar:settings— opens the settings panel
If you use a custom navbar, add
'settings' to your navbar configuration manually.SCSS variables
| Variable | Default | Description |
|---|---|---|
$font | core.$caption-font | Font used in the settings panel |
$text-color | core.$panel-text-color | Text color |
$background | core.$panel-background | Panel background color |
$item-height | core.$panel-menu-item-height | Height of each settings item |
$item-padding | core.$panel-menu-item-padding | Padding of each settings item |
$hover-background | core.$panel-menu-hover-background | Item background on hover |
$badge-font | 10px / .9 monospace | Font of the button badge |
$badge-text-color | white | Text color of the badge |
$badge-background | #111 | Background color of the badge |
