vis-core 0.16.10 → 0.16.11

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.
@@ -39665,8 +39665,14 @@ class qK extends yt {
39665
39665
  return be(this, null, function* () {
39666
39666
  const s = new Mn(0.5, 5, 2, 2);
39667
39667
  this.createGroup();
39668
- const l = new Ge(s, this.options.material), a = l.clone();
39669
- l.rotation.x = -Math.PI * 0.5, a.rotation.x = -Math.PI * 0.5, a.rotation.y = -Math.PI * 0.5, l.translateY(5 / 2), a.translateY(5 / 2), this.add(l, a);
39668
+ const l = new Ge(
39669
+ s,
39670
+ this.options.material || new _e({
39671
+ color: "#ffffff",
39672
+ side: Ht
39673
+ })
39674
+ ), a = l.clone();
39675
+ l.rotation.x = -Math.PI * 0.5, a.rotation.x = -Math.PI * 0.5, a.rotation.y = -Math.PI * 0.5, l.translateY(5 / 2), a.translateY(5 / 2), this.add(l, a), this.userData.material = l.material;
39670
39676
  });
39671
39677
  }
39672
39678
  }
@@ -39888,7 +39894,13 @@ class Zk {
39888
39894
  removeObject3d(e) {
39889
39895
  this.objectList.forEach((t, n) => {
39890
39896
  var s;
39891
- (n === e || ((s = t.meta) == null ? void 0 : s.parent) === e) && this.objectList.delete(n);
39897
+ (n === e || ((s = t.meta) == null ? void 0 : s.parent) === e) && (t.selectHide = !0);
39898
+ }), this.emitObject3dChange();
39899
+ }
39900
+ resetObject3d(e) {
39901
+ this.objectList.forEach((t, n) => {
39902
+ var s;
39903
+ (n === e || ((s = t.meta) == null ? void 0 : s.parent) === e) && (t.selectHide = !1);
39892
39904
  }), this.emitObject3dChange();
39893
39905
  }
39894
39906
  dispose() {
@@ -43639,7 +43651,7 @@ function oa(i) {
43639
43651
  const e = new _e();
43640
43652
  return e.color.setScalar(i), e;
43641
43653
  }
43642
- const Xf = "0.16.10", cp = !1;
43654
+ const Xf = "0.16.11", cp = !1;
43643
43655
  class qa {
43644
43656
  constructor(e, t = {}) {
43645
43657
  O(this, "container");
@@ -46894,9 +46906,10 @@ const Bz = Dt(ze({}, Ls), {
46894
46906
  mapDepth: () => this.options.mapDepth
46895
46907
  });
46896
46908
  O(this, "map");
46909
+ O(this, "barArr", []);
46897
46910
  this.pencilConfig = Pz, this.initSettingsObj = {
46898
46911
  "测试板块颜色.color": "#000000",
46899
- 测试立柱: !1
46912
+ 测试立柱: ""
46900
46913
  };
46901
46914
  }
46902
46915
  get mapArea() {
@@ -46904,7 +46917,7 @@ const Bz = Dt(ze({}, Ls), {
46904
46917
  }
46905
46918
  handleSetting(t, n) {
46906
46919
  return be(this, null, function* () {
46907
- return yield Kn(qo.prototype, this, "handleSetting").call(this, t, n), t === "测试板块颜色.color" ? this.setAreaEmissiveByProperty("ISO_A2", "CN", n) : t === "测试立柱" && (n ? this.addBar() : this.removeBar()), n;
46920
+ return yield Kn(qo.prototype, this, "handleSetting").call(this, t, n), t === "测试板块颜色.color" ? this.setAreaEmissiveByProperty("ISO_A2", "CN", n) : t === "测试立柱" && (typeof n == "boolean" && (n = ""), n ? this.addBar(n) : this.removeBar()), n;
46908
46921
  });
46909
46922
  }
46910
46923
  loaderAdd() {
@@ -47173,16 +47186,14 @@ const Bz = Dt(ze({}, Ls), {
47173
47186
  c();
47174
47187
  });
47175
47188
  }
47176
- addBar() {
47177
- if (!this.mList.getMaterial("bar")) {
47178
- const n = new _e({
47179
- name: "立柱",
47180
- color: 16711680,
47181
- side: Ht
47182
- });
47183
- this.mList.setMaterial("bar", n);
47184
- }
47185
- const t = [
47189
+ addBar(t) {
47190
+ this.removeBar();
47191
+ const n = this.drawController.getObject("CrossPlane", {
47192
+ key: t.replace(/.*[#_]/, "")
47193
+ });
47194
+ if (!n)
47195
+ return;
47196
+ const s = [
47186
47197
  "中国",
47187
47198
  "泰国",
47188
47199
  "缅甸",
@@ -47195,16 +47206,15 @@ const Bz = Dt(ze({}, Ls), {
47195
47206
  "马来西亚",
47196
47207
  "俄罗斯"
47197
47208
  ];
47198
- this.mapArea.filter((n) => t.includes(n.userData.NAME_CN)).forEach((n) => be(this, null, function* () {
47199
- const [s, l] = n.userData.CENTROID, a = this.getLocationPosition([s, l], 0.1), o = yield this.drawController.draw("CrossPlane", {
47200
- material: this.mList.getMaterial("bar"),
47201
- key: "bar"
47202
- });
47203
- o.position.set(...a), o.object3d.lookAt(0, 0, 0);
47209
+ this.mapArea.filter((l) => s.includes(l.userData.NAME_CN)).forEach((l) => be(this, null, function* () {
47210
+ const [a, o] = l.userData.CENTROID, c = this.getLocationPosition([a, o], 0.1), d = yield n.instantiate();
47211
+ d.position.set(...c), d.object3d.lookAt(0, 0, 0), this.barArr.push(d);
47204
47212
  }));
47205
47213
  }
47206
47214
  removeBar() {
47207
- this.drawController.erase("CrossPlane#bar");
47215
+ this.barArr.forEach((t) => {
47216
+ t.erase();
47217
+ }), this.barArr.length = 0;
47208
47218
  }
47209
47219
  };
47210
47220
  O(qo, "VisName", "earth");
@@ -48589,7 +48599,7 @@ class I2 extends A0 {
48589
48599
  return e.objectUuid = this.editor.uuidByObject(this.object), e.oldPosition = (t = this.oldPosition) == null ? void 0 : t.toArray(), e.newPosition = this.newPosition.toArray(), e.cameraControls = !!this.cameraControls, e;
48590
48600
  }
48591
48601
  fromJSON(e) {
48592
- super.fromJSON(e), this.object = this.editor.objectByUuid(e.objectUuid), e.oldPosition && (this.oldPosition = new N().fromArray(e.oldPosition)), this.newPosition = new N().fromArray(e.newPosition), e.cameraControls && (this.cameraControls = this.editor.viewport.vis.pencil.cameraControls);
48602
+ super.fromJSON(e), this.object = this.editor.objectByUuid(e.objectUuid), e.oldPosition && (this.oldPosition = new N().fromArray(e.oldPosition)), this.newPosition = new N().fromArray(e.newPosition), e.cameraControls && (this.cameraControls = this.editor.pencil.cameraControls);
48593
48603
  }
48594
48604
  }
48595
48605
  class vf extends A0 {
@@ -48774,11 +48784,12 @@ class Hf extends A0 {
48774
48784
  }
48775
48785
  execute() {
48776
48786
  var t;
48777
- this.object.erase(), (t = this.editor.viewport.vis) == null || t.mList.removeObject3d(this.object.object3d), this.editor.select(null);
48787
+ this.object.hide(), (t = this.editor.viewport.vis) == null || t.mList.removeObject3d(this.object.object3d), this.editor.select(null);
48778
48788
  }
48779
48789
  undo() {
48780
48790
  return be(this, null, function* () {
48781
- return !1;
48791
+ var t;
48792
+ this.object.show(), (t = this.editor.viewport.vis) == null || t.mList.resetObject3d(this.object.object3d);
48782
48793
  });
48783
48794
  }
48784
48795
  toJSON() {
@@ -48851,7 +48862,7 @@ class Jf extends A0 {
48851
48862
  return e.objectUuid = this.editor.uuidByObject(this.object), e.oldPosition = (t = this.oldPosition) == null ? void 0 : t.toArray(), e.newPosition = this.newPosition.toArray(), e.cameraControls = !!this.cameraControls, e;
48852
48863
  }
48853
48864
  fromJSON(e) {
48854
- super.fromJSON(e), this.object = this.editor.objectByUuid(e.objectUuid), e.oldPosition && (this.oldPosition = new N().fromArray(e.oldPosition)), this.newPosition = new N().fromArray(e.newPosition), e.cameraControls && (this.cameraControls = this.editor.viewport.vis.pencil.cameraControls);
48865
+ super.fromJSON(e), this.object = this.editor.objectByUuid(e.objectUuid), e.oldPosition && (this.oldPosition = new N().fromArray(e.oldPosition)), this.newPosition = new N().fromArray(e.newPosition), e.cameraControls && (this.cameraControls = this.editor.pencil.cameraControls);
48855
48866
  }
48856
48867
  }
48857
48868
  class ZU extends Nf {
@@ -48905,11 +48916,11 @@ class XU {
48905
48916
  return;
48906
48917
  let e;
48907
48918
  if (this.undos.length > 0 && (e = this.undos.pop()), e !== void 0) {
48908
- if (e.undo() === !1) {
48909
- this.undos.push(e);
48919
+ if (!e.name) {
48920
+ console.log("压缩配置,不支持 undo"), this.undos.push(e);
48910
48921
  return;
48911
48922
  }
48912
- this.redos.push(e), this.editor.emit("historyChanged", e);
48923
+ e.undo(), this.redos.push(e), this.editor.emit("historyChanged", e);
48913
48924
  }
48914
48925
  return e;
48915
48926
  }
@@ -49363,8 +49374,9 @@ class eB {
49363
49374
  getObjectMaterial(e, t) {
49364
49375
  if (!e)
49365
49376
  return;
49366
- let n = e.material;
49367
- return Array.isArray(n) && t !== void 0 && (n = n[t]), n;
49377
+ const n = this.pencil.getPlugin("draw").objMap.get(e);
49378
+ let s = e.material || (n == null ? void 0 : n.userData.material);
49379
+ return Array.isArray(s) && t !== void 0 && (s = s[t]), s;
49368
49380
  }
49369
49381
  setObjectMaterial(e, t, n) {
49370
49382
  var l;
@@ -49407,19 +49419,17 @@ class eB {
49407
49419
  name: u,
49408
49420
  object: h
49409
49421
  };
49410
- }), a = [...n.objectList.keys()].map(
49411
- (c) => {
49412
- const { name: d, meta: h } = n.objectList.get(c);
49413
- let r = !1;
49414
- return h != null && h.baseObject && h.remove !== !1 && (r = !0), Dt(ze({
49415
- uuid: d.replace(d[0], d[0].toLowerCase()),
49416
- object: c,
49417
- name: c.name
49418
- }, h), {
49419
- remove: r
49420
- });
49421
- }
49422
- ), o = [...l, ...a];
49422
+ }), a = [...n.objectList.keys()].filter((c) => n.objectList.get(c).selectHide !== !0).map((c) => {
49423
+ const { name: d, meta: h } = n.objectList.get(c);
49424
+ let r = !1;
49425
+ return h != null && h.baseObject && h.remove !== !1 && (r = !0), Dt(ze({
49426
+ uuid: d.replace(d[0], d[0].toLowerCase()),
49427
+ object: c,
49428
+ name: c.name
49429
+ }, h), {
49430
+ remove: r
49431
+ });
49432
+ }), o = [...l, ...a];
49423
49433
  if (o.unshift(
49424
49434
  {
49425
49435
  name: "场景",
@@ -49446,18 +49456,22 @@ class eB {
49446
49456
  }
49447
49457
  fromJSON(e, t) {
49448
49458
  return be(this, null, function* () {
49449
- var s, l;
49450
- let n;
49451
- if (typeof e == "string") {
49452
- const a = this.assetsPrefix + e, { res: o } = yield hs(a);
49453
- n = o;
49454
- } else
49455
- n = e;
49456
- return n = WU(n), Fo(n.c.version, this.sdkVersion) === 1 && console.warn(
49457
- "vis-core 版本过低,可能会出现问题",
49458
- "json:" + n.c.version,
49459
- "sdk:" + this.sdkVersion
49460
- ), this.setConfig(n.c), this.history.fromJSON(n.h, t), this.viewport.fromJSON(n.v), yield this.history.executeUndos(), (s = this.viewport.vis) == null || s.show(), (l = this.pencil.cameraControls) == null || l.saveState(), this.select(null), n;
49459
+ var n, s;
49460
+ try {
49461
+ let l;
49462
+ if (typeof e == "string") {
49463
+ const a = this.assetsPrefix + e, { res: o } = yield hs(a);
49464
+ l = o;
49465
+ } else
49466
+ l = e;
49467
+ return l = WU(l), Fo(l.c.version, this.sdkVersion) === 1 && console.warn(
49468
+ "vis-core 版本过低,可能会出现问题",
49469
+ "json:" + l.c.version,
49470
+ "sdk:" + this.sdkVersion
49471
+ ), this.setConfig(l.c), this.history.fromJSON(l.h, t), this.viewport.fromJSON(l.v), yield this.history.executeUndos(), (n = this.viewport.vis) == null || n.show(), (s = this.pencil.cameraControls) == null || s.saveState(), this.select(null), l;
49472
+ } catch (l) {
49473
+ return console.error(l), {};
49474
+ }
49461
49475
  });
49462
49476
  }
49463
49477
  toJSON() {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.16.10";
1
+ declare const _default: "0.16.11";
2
2
  export default _default;
@@ -12,6 +12,7 @@ export default class MaterialList {
12
12
  objectList: Map<THREE.Object3D<THREE.Object3DEventMap>, {
13
13
  name: string;
14
14
  meta?: any;
15
+ selectHide?: boolean;
15
16
  }>;
16
17
  install(pencil: Pencil): void;
17
18
  setMaterial(name: string, material: THREE.Material, options?: {
@@ -26,5 +27,6 @@ export default class MaterialList {
26
27
  delObject3d(object3d: THREE.Object3D): void;
27
28
  changeObject3dName(object3d: THREE.Object3D, name: string): void;
28
29
  removeObject3d(object3d: THREE.Object3D): void;
30
+ resetObject3d(object3d: THREE.Object3D): void;
29
31
  dispose(): void;
30
32
  }
@@ -61,7 +61,8 @@ export default class extends Base {
61
61
  line: ConstructorParameters<typeof MeshLineMaterial>[0];
62
62
  }): Promise<Countries | undefined>;
63
63
  checkBehindEarth(objArr: () => BaseObject[], cb: (behind: BaseObject[], front: BaseObject[]) => any, eventType?: 'update' | 'controlend'): void;
64
- addBar(): void;
64
+ barArr: BaseObject[];
65
+ addBar(id: string): void;
65
66
  removeBar(): void;
66
67
  }
67
68
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.16.10",
3
+ "version": "0.16.11",
4
4
  "scripts": {
5
5
  "start": "npm run version && PORT=5173 bundler-dev",
6
6
  "build:site": "npm run version &&PUBLIC_EXCLUDE=public/city bundler",