UNPKG

gisviewer-vue3-arcgis

Version:

在应用中引入私服的包, 项目根目录下 新建文件 .npmrc 在 .npmrc 中对包源进行配置:

65 lines (64 loc) 1.4 kB
class a { constructor(s) { if (this.syncHandles = [], this.isSync = !1, s.length < 2) throw new Error("At least two viewers are required for synchronization."); this.mainMapView = null, this.targetMapViews = s, s.forEach((i) => { i.on("drag", () => { this.setMainMapView(i); }); }); } /** * 设置是否同步 * * @param {boolean} isSync * @memberof syncMapView */ setSync(s) { this.isSync = s; } /** *设置主视图 * * @private * @param {(MapView | SceneView)} mainMapView * @memberof syncMapView */ setMainMapView(s) { this.mainMapView !== s && (this.pauseSync(), this.mainMapView = s, this.startSync()); } /** *开始同步视角 * * @private * @memberof syncMapView */ startSync() { this.syncHandles = this.targetMapViews.map((s) => s.watch("viewpoint", (i) => { this.mainMapView === s && this.isSync && this.targetMapViews.forEach((t) => { t !== s && (t.viewpoint = i.clone()); }); })); } /** * 暂停同步视角 * * @memberof syncMapView */ pauseSync() { this.syncHandles.forEach((s) => { s.remove(); }), this.syncHandles = []; } /** *销毁同步 * * @memberof syncMapView */ destroy() { this.pauseSync(), this.mainMapView = null, this.targetMapViews = []; } } export { a as default };