archgine 1.0.59 → 1.0.60

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.
@@ -12,6 +12,7 @@ export declare class AppCvs<Config extends IApplicationConfig> extends Applicati
12
12
  mainScene: MainScene<Config>;
13
13
  animateScene: AnimateScene<Config>;
14
14
  director: AppDirector<Config>;
15
+ requestHeader: any;
15
16
  private _url?;
16
17
  private _layers?;
17
18
  private _tic?;
@@ -24,6 +25,7 @@ export declare class AppCvs<Config extends IApplicationConfig> extends Applicati
24
25
  bindEvents(): void;
25
26
  unbindEvents(): void;
26
27
  handleCameraChanged(): void;
28
+ setRequestHeader(requestHeader: any): AppCvs<any>;
27
29
  trans2LoadingScene(): Promise<void>;
28
30
  load(url?: string, layers?: string[]): Promise<void>;
29
31
  pushResources2Scene(res?: IObject2[]): void;
@@ -4010,7 +4010,7 @@ Fu.__DOMHandler = Eu;
4010
4010
  Fu.normalizeLineEndings = Le;
4011
4011
  Fu.DOMParser = Ie;
4012
4012
  var gr = Fu.DOMParser;
4013
- const Er = "1.0.59";
4013
+ const Er = "1.0.60";
4014
4014
  function vr() {
4015
4015
  return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
4016
4016
  }
@@ -8,6 +8,7 @@ export declare class Adapter extends EventDispatcher {
8
8
  params: IApplicationConfig;
9
9
  boundingBox: Box2;
10
10
  offset: Vector2;
11
+ requestHeader: any;
11
12
  resources: Record<string, IObject2[]>;
12
13
  _resourcesMap: Record<string, IObject2>;
13
14
  _resourcesTree: ITree[];
@@ -21,6 +22,7 @@ export declare class Adapter extends EventDispatcher {
21
22
  constructor(config?: IApplicationConfig);
22
23
  destroy(): void;
23
24
  clear(): void;
25
+ setRequestHeader(requestHeader: any): Adapter;
24
26
  load(url: string, layers?: string[]): Promise<void>;
25
27
  init(str?: string): Promise<void>;
26
28
  loadBySax(url: string, layers?: string[]): Promise<void>;
package/lib/index.mjs CHANGED
@@ -4010,7 +4010,7 @@ uu.__DOMHandler = La;
4010
4010
  uu.normalizeLineEndings = Td;
4011
4011
  uu.DOMParser = _d;
4012
4012
  var Gx = uu.DOMParser;
4013
- const Yx = "1.0.59";
4013
+ const Yx = "1.0.60";
4014
4014
  function Xx() {
4015
4015
  return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
4016
4016
  }
@@ -12160,7 +12160,7 @@ class zd extends bE {
12160
12160
  isBelongsToAssetType(t, e) {
12161
12161
  e || (e = this.assetType);
12162
12162
  const i = this.getAssetsByType(e);
12163
- return i == null ? void 0 : i.hasOwnProperty(t);
12163
+ return i ? i == null ? void 0 : i.hasOwnProperty(t) : !1;
12164
12164
  }
12165
12165
  setAssetsMap(t, e = {}) {
12166
12166
  const i = this.chef.getElementById(xa(t));
@@ -12193,21 +12193,27 @@ class zd extends bE {
12193
12193
  return e ? Mt.keys(e) : i;
12194
12194
  }
12195
12195
  clearFillOrStroke(t = "fill") {
12196
- const e = this.getAssetsByType(this.assetType), i = Mt.keys(e);
12196
+ const e = this.getAssetsByType(this.assetType);
12197
+ if (!e) return;
12198
+ const i = Mt.keys(e);
12197
12199
  let a;
12198
12200
  for (let o = 0, l = i.length; o < l; o++)
12199
12201
  a = e[i[o]], !(!a || !a.hasAttribute(t)) && (a.removeAttribute(t), t === "stroke" && a.removeAttribute("stroke-width"));
12200
12202
  this.clearLegendBy(t);
12201
12203
  }
12202
12204
  clearFillOrStrokeByIds(t, e = "fill") {
12203
- const i = this.getAssetsByType(this.assetType), a = Mt.keys(i);
12205
+ const i = this.getAssetsByType(this.assetType);
12206
+ if (!i) return;
12207
+ const a = Mt.keys(i);
12204
12208
  let o;
12205
12209
  for (let l = 0, c = a.length; l < c; l++)
12206
12210
  t != null && t.length && !t.includes(a[l]) || (o = i[a[l]], !(!o || !o.hasAttribute(e)) && (o.removeAttribute(e), e === "stroke" && o.removeAttribute("stroke-width")));
12207
12211
  this.clearLegendBy(e);
12208
12212
  }
12209
12213
  setFillOrStrokeByIds(t, e, i = "fill") {
12210
- const a = this.getAssetsByType(this.assetType), o = Mt.keys(a);
12214
+ const a = this.getAssetsByType(this.assetType);
12215
+ if (!a) return;
12216
+ const o = Mt.keys(a);
12211
12217
  let l;
12212
12218
  for (let c = 0, f = o.length; c < f; c++)
12213
12219
  t.includes(o[c]) && (l = a[o[c]], l && (l.setAttribute(i, e), i === "stroke" && l.setAttribute("stroke-width", "7"), this.addLegend(i, e, o[c])));
@@ -12297,7 +12303,9 @@ class zd extends bE {
12297
12303
  // ====================== selected
12298
12304
  getIntersectObjects(t, e = dr.RM, i = []) {
12299
12305
  i.length = 0;
12300
- const a = [], o = this.getAssetsByType(e), l = Mt.keys(o);
12306
+ const a = [], o = this.getAssetsByType(e);
12307
+ if (!o) return i;
12308
+ const l = Mt.keys(o);
12301
12309
  for (let f = 0, d = l.length; f < d; f++) {
12302
12310
  const g = this.chef.getElementBoundingBox(o[l[f]].id);
12303
12311
  g && g.containsPoint(t.worldCoords) && a.push(o[l[f]]);
@@ -12368,11 +12376,13 @@ class zd extends bE {
12368
12376
  selectByIds(t, e = !1) {
12369
12377
  Array.isArray(t) || (t = [t]), e || this.clearSelected();
12370
12378
  const i = Mt.uniq(Mt.map(this.selectedList, (o) => o.getAttribute("id") || "")), a = this.getAssetsByType(this.assetType);
12371
- for (let o = t.length - 1; o >= 0; o--)
12372
- i.includes(t[o]) ? (this.clearSelectedById(t[o]), t.splice(o, 1)) : Object.hasOwnProperty.call(a, t[o]) && this.selectedList.push(a[t[o]]);
12373
- this.selectedList.forEach((o) => {
12374
- this.chef.setElementState2selected(o, !0);
12375
- });
12379
+ if (a) {
12380
+ for (let o = t.length - 1; o >= 0; o--)
12381
+ i.includes(t[o]) ? (this.clearSelectedById(t[o]), t.splice(o, 1)) : Object.hasOwnProperty.call(a, t[o]) && this.selectedList.push(a[t[o]]);
12382
+ this.selectedList.forEach((o) => {
12383
+ this.chef.setElementState2selected(o, !0);
12384
+ });
12385
+ }
12376
12386
  }
12377
12387
  getSelectedIds() {
12378
12388
  var e;
@@ -12405,6 +12415,7 @@ class zd extends bE {
12405
12415
  // }
12406
12416
  getElementsByBox(t) {
12407
12417
  const e = [], i = Object.keys(this.chef.boundingBoxMap), a = this.getAssetsByType(this.assetType);
12418
+ if (!a) return e;
12408
12419
  for (let o = 0, l = i.length; o < l; o++)
12409
12420
  if (a.hasOwnProperty(i[o]) && !(i[o].indexOf("-assets") > -1) && t.intersectsBox(this.chef.boundingBoxMap[i[o]])) {
12410
12421
  const c = a[i[o]];