@nsc-earth-v2/sync-viewer
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@nsc-earth-v2/sync-viewer

@nsc-earth-v2/sync-viewer is an npm package for synchronizing two Cesium Viewer instances. 中文 Readme

Installation

npm install @nsc-earth-v2/sync-viewer

Usage

import { Viewer } from "cesium";
import SyncViewer from "@nsc-earth-v2/sync-viewer";

const leftViewer = new Viewer("left-container");
const rightViewer = new Viewer("right-container");

const syncViewer = new SyncViewer(leftViewer, rightViewer);

// Destroy
syncViewer.destroy();

API

SyncViewProps

Property Name Type Description
percentageChanged number The percentage of distance changed when the camera zooms in.

SyncViewer

Constructor

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 to 0.01.

Methods

start()

Start synchronizing the views of the left and right viewers.

start(): void
destroy()

Destroy the instance and unsynchronize the views of the left and right viewers.

destroy(): void

Properties

synchronous

Get or set whether to synchronize the views.

synchronous: boolean;
isDestory

Get whether the instance has been destroyed.

get isDestory(): boolean

Events

leftChangeEvent()

Triggered when the view of the left viewer changes, used to synchronize the view of the right viewer.

rightChangeEvent()

Triggered when the view of the right viewer changes, used to synchronize the view of the left viewer.

Readme

Keywords

Package Sidebar

Install

npm i @nsc-earth-v2/sync-viewer

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

7.62 kB

Total Files

5

Last publish

Collaborators

  • npm-support