@nsc-earth-2/sync-viewer
is an npm package for synchronizing two Cesium Viewer instances.
中文 Readme
npm install @nsc-earth-2/sync-viewer
import { Viewer } from "cesium";
import SyncViewer from "@nsc-earth-2/sync-viewer";
const leftViewer = new Viewer("left-container");
const rightViewer = new Viewer("right-container");
const syncViewer = new SyncViewer(leftViewer, rightViewer);
// Destroy
syncViewer.destroy();
Property Name | Type | Description |
---|---|---|
percentageChanged | number |
The percentage of distance changed when the camera zooms in. |
constructor(leftViewer: Viewer, rightViewer: Viewer, options?: SyncViewProps)
-
leftViewer
: A Cesium Viewer instance on the left. -
rightViewer
: A Cesium Viewer instance on the right. -
options
(optional): An object containing options:-
percentageChanged
: The percentage of distance changed when the camera zooms in, default to0.01
.
-
Start synchronizing the views of the left and right viewers.
start(): void
Destroy the instance and unsynchronize the views of the left and right viewers.
destroy(): void
Get or set whether to synchronize the views.
synchronous: boolean;
Get whether the instance has been destroyed.
get isDestory(): boolean
Triggered when the view of the left viewer changes, used to synchronize the view of the right viewer.
Triggered when the view of the right viewer changes, used to synchronize the view of the left viewer.