vis-core 0.27.5 → 0.27.7

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.
@@ -88,7 +88,7 @@ const publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRz
88
88
  ).toString(CryptoJS.enc.Utf8), Ne = JSON.parse(Re), ke = Date.now();
89
89
  return !Ne.s || Ne.s > ke ? (this.token = void 0, "") : Ne.e && Ne.e < ke ? (this.token = void 0, "") : (Ne.isValid = ye, Ne);
90
90
  }
91
- }, version = "0.27.5";
91
+ }, version = "0.27.7";
92
92
  /**
93
93
  * @license
94
94
  * Copyright 2010-2025 Three.js Authors
@@ -60320,12 +60320,29 @@ class Base extends Camera {
60320
60320
  const r = this.pencil;
60321
60321
  this.lead = r.lead.init(this.leadObjs), this.delLoadArr && (r.loader.delLoadArr = this.delLoadArr), r.loader.on("progress", (...Re) => {
60322
60322
  this.showState !== !0 && this.emit("loaderProgress", ...Re);
60323
- }), this.leftTruck && (r.controls.mouseButtons.left = Ki.TRUCK, r.controls.mouseButtons.right = Ki.ROTATE), this.lead.group.hide(), this.lead.prefabGroup.hide(), this.initSceneUserData(), this.initSettings();
60323
+ }), this.leftTruck && (r.controls.mouseButtons.left = Ki.TRUCK, r.controls.mouseButtons.right = Ki.ROTATE), this.lead.group.hide(), this.lead.prefabGroup.hide(), this.initSceneUserData(), this.initCameraUserData(), this.initSettings();
60324
60324
  });
60325
60325
  }
60326
60326
  setSceneActive() {
60327
60327
  this.pencil.showPage(this.sceneActive), this.pencil.installPlugins.set("materialList", this.mList);
60328
60328
  }
60329
+ initCameraUserData() {
60330
+ const r = this.pencil;
60331
+ r.camera.userData = new Proxy(
60332
+ {
60333
+ up: r.camera.up.toArray().join(",")
60334
+ },
60335
+ {
60336
+ set: (d, v, C) => {
60337
+ if (v === "up") {
60338
+ const _ = C.split(",").map((w) => +w);
60339
+ r.camera.up.set(_[0], _[1], _[2]), r.controls.updateCameraUp();
60340
+ }
60341
+ return Reflect.set(d, v, C);
60342
+ }
60343
+ }
60344
+ );
60345
+ }
60329
60346
  initSceneUserData() {
60330
60347
  var w, fe, ye, Le, Re, Ne;
60331
60348
  const r = this.pencil, d = r.scene.background, v = d instanceof Color$1 ? "Color" : d instanceof Texture ? "Texture" : "None", C = v === "Texture" ? d : null, _ = v === "Color" ? "#" + d.getHexString() : "#000000";
@@ -139754,82 +139771,87 @@ class City$1 extends Base {
139754
139771
  }
139755
139772
  initMaterial() {
139756
139773
  return B0(this, null, function* () {
139757
- const r = ["20", "60", "max"].reduce(
139758
- (_, w) => {
139759
- const fe = this.loader.getAsset(`/image/city/${w}-1.jpg`), ye = this.loader.getAsset(`/image/city/${w}.webp`);
139760
- return _[w] = [
139761
- new MeshBasicMaterial({
139762
- name: "建筑顶面-板块内" + w + "高",
139763
- color: "#00a3bc"
139764
- }),
139765
- new MeshStandardMaterial({
139766
- name: "建筑侧面-板块内" + w + "高",
139767
- map: fe,
139768
- normalMap: ye,
139769
- envMap: this.getRoomEnvMap()
139770
- // envMapIntensity: 2,
139771
- })
139772
- ], [fe, ye].forEach((Le) => {
139773
- Le.wrapS = RepeatWrapping, Le.wrapT = RepeatWrapping, Le.repeat.set(1, 1);
139774
- }), _;
139775
- },
139776
- {}
139777
- );
139778
- this.mList.addMultiple("building", {
139779
- "20Top": r[20][0],
139780
- "20Side": r[20][1],
139781
- "60Top": r[60][0],
139782
- "60Side": r[60][1],
139783
- maxTop: r.max[0],
139784
- maxSide: r.max[1]
139785
- });
139786
- const d = ["20", "60", "max"].reduce(
139787
- (_, w) => {
139788
- const fe = this.loader.getAsset(`/image/city/${w}-1.jpg`), ye = this.loader.getAsset(`/image/city/${w}.webp`);
139789
- return _[w] = [
139790
- new MeshBasicMaterial({
139791
- name: "建筑顶面-板块外" + w + "高",
139792
- color: "#133144"
139793
- }),
139794
- new MeshStandardMaterial({
139795
- name: "建筑侧面-块外" + w + "高",
139796
- map: fe,
139797
- normalMap: ye,
139798
- envMap: this.getRoomEnvMap()
139799
- // envMapIntensity: 2,
139800
- })
139801
- ], [fe, ye].forEach((Le) => {
139802
- Le.wrapS = RepeatWrapping, Le.wrapT = RepeatWrapping, Le.repeat.set(1, 1);
139803
- }), _;
139804
- },
139805
- {}
139806
- );
139807
- this.mList.addMultiple("building-grey", {
139808
- "20Top": d[20][0],
139809
- "20Side": d[20][1],
139810
- "60Top": d[60][0],
139811
- "60Side": d[60][1],
139812
- maxTop: d.max[0],
139813
- maxSide: d.max[1]
139814
- });
139815
- const v = new De({
139816
- //@ts-ignore
139817
- name: "道路-板块内",
139818
- color: "#ffc457",
139819
- sizeAttenuation: 0,
139820
- lineWidth: 40
139821
- }), C = new De({
139822
- //@ts-ignore
139823
- name: "道路-板块外",
139824
- color: "#4a3f15",
139825
- sizeAttenuation: 0,
139826
- lineWidth: 40
139827
- });
139828
- this.mList.addMultiple("road", {
139829
- primary: v
139830
- }), this.mList.addMultiple("road-grey", {
139831
- primary: C
139832
- }), this.mList.addMultiple("geography", {
139774
+ if (this.options.showBuilding) {
139775
+ const r = ["20", "60", "max"].reduce(
139776
+ (v, C) => {
139777
+ const _ = this.loader.getAsset(`/image/city/${C}-1.jpg`), w = this.loader.getAsset(`/image/city/${C}.webp`);
139778
+ return v[C] = [
139779
+ new MeshBasicMaterial({
139780
+ name: "建筑顶面-板块内" + C + "高",
139781
+ color: "#00a3bc"
139782
+ }),
139783
+ new MeshStandardMaterial({
139784
+ name: "建筑侧面-板块内" + C + "高",
139785
+ map: _,
139786
+ normalMap: w,
139787
+ envMap: this.getRoomEnvMap()
139788
+ // envMapIntensity: 2,
139789
+ })
139790
+ ], [_, w].forEach((fe) => {
139791
+ fe.wrapS = RepeatWrapping, fe.wrapT = RepeatWrapping, fe.repeat.set(1, 1);
139792
+ }), v;
139793
+ },
139794
+ {}
139795
+ );
139796
+ this.mList.addMultiple("building", {
139797
+ "20Top": r[20][0],
139798
+ "20Side": r[20][1],
139799
+ "60Top": r[60][0],
139800
+ "60Side": r[60][1],
139801
+ maxTop: r.max[0],
139802
+ maxSide: r.max[1]
139803
+ });
139804
+ const d = ["20", "60", "max"].reduce(
139805
+ (v, C) => {
139806
+ const _ = this.loader.getAsset(`/image/city/${C}-1.jpg`), w = this.loader.getAsset(`/image/city/${C}.webp`);
139807
+ return v[C] = [
139808
+ new MeshBasicMaterial({
139809
+ name: "建筑顶面-板块外" + C + "高",
139810
+ color: "#133144"
139811
+ }),
139812
+ new MeshStandardMaterial({
139813
+ name: "建筑侧面-块外" + C + "高",
139814
+ map: _,
139815
+ normalMap: w,
139816
+ envMap: this.getRoomEnvMap()
139817
+ // envMapIntensity: 2,
139818
+ })
139819
+ ], [_, w].forEach((fe) => {
139820
+ fe.wrapS = RepeatWrapping, fe.wrapT = RepeatWrapping, fe.repeat.set(1, 1);
139821
+ }), v;
139822
+ },
139823
+ {}
139824
+ );
139825
+ this.mList.addMultiple("building-grey", {
139826
+ "20Top": d[20][0],
139827
+ "20Side": d[20][1],
139828
+ "60Top": d[60][0],
139829
+ "60Side": d[60][1],
139830
+ maxTop: d.max[0],
139831
+ maxSide: d.max[1]
139832
+ });
139833
+ }
139834
+ if (this.options.showRoad) {
139835
+ const r = new De({
139836
+ //@ts-ignore
139837
+ name: "道路-板块内",
139838
+ color: "#ffc457",
139839
+ sizeAttenuation: 0,
139840
+ lineWidth: 40
139841
+ }), d = new De({
139842
+ //@ts-ignore
139843
+ name: "道路-板块外",
139844
+ color: "#4a3f15",
139845
+ sizeAttenuation: 0,
139846
+ lineWidth: 40
139847
+ });
139848
+ this.mList.addMultiple("road", {
139849
+ primary: r
139850
+ }), this.mList.addMultiple("road-grey", {
139851
+ primary: d
139852
+ });
139853
+ }
139854
+ (this.options.showRiver || this.options.showGrassland) && (this.mList.addMultiple("geography", {
139833
139855
  river: new MeshBasicMaterial({
139834
139856
  name: "河流-板块内",
139835
139857
  color: "#115d8a"
@@ -139847,7 +139869,7 @@ class City$1 extends Base {
139847
139869
  name: "绿地-板块外",
139848
139870
  color: "#133341"
139849
139871
  })
139850
- }), this.mList.add(
139872
+ })), this.mList.add(
139851
139873
  "city-plane",
139852
139874
  new MeshBasicMaterial({
139853
139875
  name: "底面",
@@ -139858,16 +139880,16 @@ class City$1 extends Base {
139858
139880
  }
139859
139881
  disableSSAO() {
139860
139882
  const r = this.pencil.composerController.ssaoPass;
139861
- r && (r.enabled = !1);
139883
+ r && r.enabled && (r.enabled = !1, console.log("disableSSAO"));
139862
139884
  }
139863
139885
  enabledSSAO() {
139864
139886
  const r = this.pencil.composerController.ssaoPass;
139865
- r && (r.enabled = !0);
139887
+ r && !r.enabled && (r.enabled = !0, console.log("enabledSSAO"));
139866
139888
  }
139867
139889
  init() {
139868
139890
  return B0(this, null, function* () {
139869
139891
  const { jsonName: r, adcode: d } = this.options;
139870
- yield this.initPencil(), this.tier0 || this.enabledSSAO(), this.loaderAdd(), this.loaderAddJson(r), console.time(`vis-core:time.${this.visName}${d}-loader`), yield this.loader.loadAll(), console.timeEnd(`vis-core:time.${this.visName}${d}-loader`), this.settings.mouseLeft = Ki.SCREEN_PAN, yield this.settings.mouseLeft, this.pencil.camera.up = new Vector3(0, 0, 1), this.pencil.controls.updateCameraUp(), this.adcode = this.options.adcode, this.options.center && (this.pcenter = this.options.center), this.projection = m({
139892
+ yield this.initPencil(), this.loaderAdd(), this.loaderAddJson(r), console.time(`vis-core:time.${this.visName}${d}-loader`), yield this.loader.loadAll(), console.timeEnd(`vis-core:time.${this.visName}${d}-loader`), this.settings.mouseLeft = Ki.SCREEN_PAN, yield this.settings.mouseLeft, this.pencil.camera.userData.up = "0,0,1", this.adcode = this.options.adcode, this.options.center && (this.pcenter = this.options.center), this.projection = m({
139871
139893
  center: this.pcenter,
139872
139894
  scale: this.pscale
139873
139895
  }), this.group = yield this.lead.draw("Group", {
@@ -139901,11 +139923,7 @@ class City$1 extends Base {
139901
139923
  }
139902
139924
  initVis() {
139903
139925
  return B0(this, null, function* () {
139904
- const { fitTo: r, jsonName: d, planeOut: v } = this.options, C = this.adcode, _ = this.loader, w = _.getAsset(
139905
- `/cityGzip/Building${d}.json.gzip`
139906
- ), fe = _.getAsset(`/cityGzip/Road${d}.json.gzip`), ye = _.getAsset(`/cityGzip/River${d}.json.gzip`), Le = _.getAsset(
139907
- `/cityGzip/Grassland${d}.json.gzip`
139908
- ), Re = {};
139926
+ const { fitTo: r, jsonName: d, planeOut: v } = this.options, C = this.adcode, _ = this.loader, w = this.options.showBuilding && _.getAsset(`/cityGzip/Building${d}.json.gzip`), fe = this.options.showRoad && _.getAsset(`/cityGzip/Road${d}.json.gzip`), ye = this.options.showRiver && _.getAsset(`/cityGzip/River${d}.json.gzip`), Le = this.options.showGrassland && _.getAsset(`/cityGzip/Grassland${d}.json.gzip`), Re = {};
139909
139927
  [
139910
139928
  ...(ye == null ? void 0 : ye.features) || [],
139911
139929
  ...(Le == null ? void 0 : Le.features) || []
@@ -139928,28 +139946,28 @@ class City$1 extends Base {
139928
139946
  selectHide: !0
139929
139947
  })), yield Promise.all(
139930
139948
  [
139931
- w && this.options.showBuilding && this.drawBuilding({
139949
+ w && this.drawBuilding({
139932
139950
  json: w,
139933
139951
  meters: ke,
139934
139952
  clip: this.options.clip,
139935
139953
  grey: this.options.grey,
139936
139954
  sideGradient: this.options.buildingSideGradient
139937
139955
  }),
139938
- fe && this.options.showRoad && this.drawRoad({
139956
+ fe && this.drawRoad({
139939
139957
  json: fe,
139940
139958
  meters: ke,
139941
139959
  z: Ne.length,
139942
139960
  clip: this.options.clip,
139943
139961
  grey: this.options.grey
139944
139962
  }),
139945
- ye && this.options.showRiver && this.drawArea({
139963
+ ye && this.drawArea({
139946
139964
  json: ye,
139947
139965
  type: "river",
139948
139966
  oArr: Ne,
139949
139967
  clip: this.options.clip,
139950
139968
  grey: this.options.grey
139951
139969
  }),
139952
- Le && this.options.showGrassland && this.drawArea({
139970
+ Le && this.drawArea({
139953
139971
  json: Le,
139954
139972
  type: "grassland",
139955
139973
  oArr: Ne,
@@ -139964,7 +139982,9 @@ class City$1 extends Base {
139964
139982
  this.innerAreaGroup
139965
139983
  )
139966
139984
  ].filter(Boolean)
139967
- ), r && this.fitToTarget(C), this.pencil.getPlugin("worker").saveCache();
139985
+ ), r && this.fitToTarget(C), this.pencil.getPlugin("worker").saveCache(), !this.tier0 && this.options.showBuilding && this.pencil.controls.addEventListener("update", () => {
139986
+ this.pencil.controls.distance < 0.1 ? this.enabledSSAO() : this.disableSSAO();
139987
+ });
139968
139988
  });
139969
139989
  }
139970
139990
  fitToTarget(r, d) {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.27.5";
1
+ declare const _default: "0.27.7";
2
2
  export default _default;
@@ -97,6 +97,7 @@ export default class Base extends Camera {
97
97
  initPencil(): Promise<void>;
98
98
  private sceneActive;
99
99
  setSceneActive(): void;
100
+ initCameraUserData(): void;
100
101
  initSceneUserData(): void;
101
102
  initBaseObjectUserData(baseObject: BaseObject): void;
102
103
  addCSS3DRenderer(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.27.5",
3
+ "version": "0.27.7",
4
4
  "scripts": {
5
5
  "start": "npm run version && PORT=5173 bundler-dev",
6
6
  "build:site": "npm run version && bundler",