# VisibleRangePlugin

NPM version NPM Downloads jsDelivr Hits
API Documentation

Locks the visible area of the panorama.

This plugin is available in the @photo-sphere-viewer/visible-range-plugin (opens new window) package.

# Usage

The plugin allows to define horizontalRange and verticalRange to lock to viewable zone. It affects manual moves and automatic rotation.

const viewer = new PhotoSphereViewer.Viewer({
    plugins: [
        [PhotoSphereViewer.VisibleRangePlugin, {
            horizontalRange: [-Math.PI / 2, Math.PI / 2],
            verticalRange: [-Math.PI / 3, Math.PI / 3],
        }],
    ],
});

const visibleRangePlugin = viewer.getPlugin(PhotoSphereViewer.VisibleRangePlugin);

visibleRangePlugin.setHorizontalRange(['0deg', '180deg']);
visibleRangePlugin.setVerticalRange(null);

Alternatively, if usePanoData is set to true, the visible range is limited to the cropped panorama data provided to the viewer.

# Example

# Configuration

# horizontalRange

  • type: double[]|string[]
  • default: null
  • updatable: no, use setHorizontalRange() plugin

Visible horizontal range as two angles.

# verticalRange

  • type: double[]|string[]
  • default: null
  • updatable: no, use setVerticalRange() plugin

Visible vertical range as two angles.

# usePanoData

  • type: boolean
  • default: false
  • updatable: yes

Use cropped panorama data as visible range immediately after load.

# Methods

# setHorizontalRange(range) | setVerticalRange(range)

Change or remove the ranges.

# setRangesFromPanoData()

Use cropped panorama data as visible range.