cesium-mars-op-cog 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,6 +47,8 @@ export declare class CogMarsLayer extends mars3d.layer.BaseLayer {
47
47
  private _imageryLayer;
48
48
  private _cogProvider;
49
49
  private _initPromise;
50
+ private _flyToReady;
51
+ private _resolveFlyToReady;
50
52
  constructor(options: CogMarsLayerOptions);
51
53
  /**
52
54
  * 图层被添加到地图时自动调用
package/dist/index.js CHANGED
@@ -396,13 +396,17 @@ var Z = class extends m.layer.BaseLayer {
396
396
  _imageryLayer = null;
397
397
  _cogProvider = null;
398
398
  _initPromise = null;
399
+ _flyToReady;
400
+ _resolveFlyToReady = null;
399
401
  constructor(A) {
400
402
  const t = {
401
403
  id: A.id,
402
404
  name: A.name,
403
405
  show: A.show
404
406
  };
405
- super(t), this._cogUrl = A.url, this._cogAlpha = A.alpha ?? 1, this._cogOptions = {
407
+ super(t), this._cogUrl = A.url, this._cogAlpha = A.alpha ?? 1, this._flyToReady = new Promise((e) => {
408
+ this._resolveFlyToReady = e;
409
+ }), this._cogOptions = {
406
410
  poolSize: A.poolSize,
407
411
  maxLoadPerWorker: A.maxLoadPerWorker,
408
412
  timeout: A.timeout,
@@ -422,7 +426,7 @@ var Z = class extends m.layer.BaseLayer {
422
426
  await A.init(), this._cogProvider = A;
423
427
  const t = this._map;
424
428
  if (!t || this.isDestroy) return;
425
- this._imageryLayer = t.imageryLayers.addImageryProvider(A), this._imageryLayer.alpha = this._cogAlpha, this.fire("load", { target: this });
429
+ this._imageryLayer = t.imageryLayers.addImageryProvider(A), this._imageryLayer.alpha = this._cogAlpha, this.fire("load", { target: this }), this._resolveFlyToReady?.();
426
430
  } catch (A) {
427
431
  console.error("[CogMarsLayer] 初始化失败:", A);
428
432
  }
@@ -476,7 +480,7 @@ var Z = class extends m.layer.BaseLayer {
476
480
  return this._cogProvider;
477
481
  }
478
482
  async flyTo(A) {
479
- if (await this.readyPromise, !this._cogProvider) return !1;
483
+ if (await this._flyToReady, !this._cogProvider) return !1;
480
484
  const t = this._cogProvider.bboxDegrees;
481
485
  if (t[2] === t[0] || t[3] === t[1]) return !1;
482
486
  const e = this._map;