Skip to main content

Pan Buttons

Provides buttons around the perimeter of the Surface canvas that allow the user to nudge the pan. Users can click and hold to auto pan.

Setup​

import { Component, ViewChild } from '@angular/core';
import { SurfaceComponent } from '@visuallyjs/browser-ui-angular';
import { PanButtonsPlugin } from "@visuallyjs/browser-ui"


@Component({
selector: 'app-root',
template: ` <vjs-surface [renderOptions]="renderOptions"></vjs-surface> `
})
export class AppComponent {
renderOptions = {
plugins: [
PanButtonsPlugin.type
]
};
}

CSS Classes​

There are a number of classes added to the elements this plugin creates, allowing you to style the buttons as you like:

ClassDescription
vjs-surface-panAssigned to each of the pan buttons added around the surface.
vjs-surface-pan-activeAssigned when the user is pressing a pan button and a pan is in motion.
vjs-surface-pan-bottomAssigned to the pan button on the bottom edge of the surface.
vjs-surface-pan-leftAssigned to the pan button added on the left edge of the surface.
vjs-surface-pan-rightAssigned to the pan button on the right edge of the surface.
vjs-surface-pan-topAssigned by to the pan button on the top edge of the surface.

Options​

PanButtonsPluginOptions
Options for the pan buttons plugin.
NameTypeDescription
panDistance?numberAmount in pixels to pan the surface by when one of the buttons is pressed and released. Defaults to 50.
panRepeatDistance?numberAmount in pixels to adjust pan by each time the timer fires. Defaults to 10.
panRepeatInterval?numberTime in milliseconds between successive adjustment to the pan. Defaults to 60.
startPanTimeout?numberTime in milliseconds after the mouse button is pressed before panning should start. Defaults to 150.