vis-core 0.28.15 → 0.28.17

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(Pe), Ae = Date.now();
89
89
  return !Ne.s || Ne.s > Ae ? (this.token = void 0, "") : Ne.e && Ne.e < Ae ? (this.token = void 0, "") : (Ne.isValid = O, Ne);
90
90
  }
91
- }, version = "0.28.15";
91
+ }, version = "0.28.17";
92
92
  /**
93
93
  * @license
94
94
  * Copyright 2010-2025 Three.js Authors
@@ -58425,6 +58425,13 @@ class SetMaterialColor extends Command {
58425
58425
  this.materialSlot
58426
58426
  ), this.attributeName = t.attributeName, this.oldValue = t.oldValue, this.newValue = t.newValue;
58427
58427
  }
58428
+ fixJSON() {
58429
+ const t = this.json;
58430
+ if (this.material) {
58431
+ const r = this.editor.pencil.mList.getKey(this.material);
58432
+ r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
58433
+ }
58434
+ }
58428
58435
  }
58429
58436
  class SetMaterial extends Command {
58430
58437
  constructor(t, r, m, v) {
@@ -58459,7 +58466,7 @@ class SetMaterial extends Command {
58459
58466
  const t = this.json;
58460
58467
  if (t && t.oldMaterial && delete t.oldMaterial, this.oldMaterial) {
58461
58468
  const r = this.editor.pencil.mList.getKey(this.oldMaterial);
58462
- r && r !== t.objectUuid && (console.warn("SetMaterial:fix:", t.objectUuid, r), t.objectUuid = r);
58469
+ r && r !== t.objectUuid && (console.warn("SetMaterial:fix:", t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
58463
58470
  }
58464
58471
  }
58465
58472
  }
@@ -58497,7 +58504,7 @@ class SetMaterialMap extends Command {
58497
58504
  const t = new re$1();
58498
58505
  t.track(this.oldMap), t.dispose();
58499
58506
  }
58500
- this.newMap && (this.newMap.anisotropy = this.editor.viewport.vis.tier0 ? 1 : this.editor.pencil.maxAnisotropy), this.material[this.mapName] = this.newMap, this.playVideo(this.newMap), this.material instanceof Te$1 && (this.material.useMap = !!this.newMap, this.newMap && this.newMap.wrapS !== RepeatWrapping && (this.newMap.wrapS = RepeatWrapping, this.newMap.wrapT = RepeatWrapping, this.newMap.needsUpdate = !0)), (!this.oldMap && this.newMap || this.oldMap && !this.newMap) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material);
58507
+ this.newMap && (this.newMap.name === "PMREM.cubeUv" && (this.newMap = this.editor.viewport.vis.getRoomEnvMap()), this.newMap.anisotropy = this.editor.viewport.vis.tier0 ? 1 : this.editor.pencil.maxAnisotropy), this.material[this.mapName] = this.newMap, this.playVideo(this.newMap), this.material instanceof Te$1 && (this.material.useMap = !!this.newMap, this.newMap && this.newMap.wrapS !== RepeatWrapping && (this.newMap.wrapS = RepeatWrapping, this.newMap.wrapT = RepeatWrapping, this.newMap.needsUpdate = !0)), (!this.oldMap && this.newMap || this.oldMap && !this.newMap) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material);
58501
58508
  }
58502
58509
  }
58503
58510
  undo() {
@@ -58517,11 +58524,14 @@ class SetMaterialMap extends Command {
58517
58524
  super.fromJSON(t), this.object = this.editor.materialObjectByUuid(t.objectUuid), this.materialSlot = t.materialSlot, this.material = this.editor.getObjectMaterial(
58518
58525
  this.object,
58519
58526
  this.materialSlot
58520
- ), this.mapName = t.mapName, this.oldMap = this.object && this.material ? this.material[this.mapName] : void 0, this.newMap = parseTexture(t.newMap);
58527
+ ), this.mapName = t.mapName, this.oldMap = this.object && this.material ? this.material[this.mapName] : void 0, t.newMap.name === "PMREM.cubeUv" ? this.newMap = this.editor.viewport.vis.getRoomEnvMap() : this.newMap = parseTexture(t.newMap);
58521
58528
  }
58522
58529
  fixJSON() {
58523
58530
  const t = this.json;
58524
- t && t.oldMap && delete t.oldMap;
58531
+ if (t && t.oldMap && delete t.oldMap, this.material) {
58532
+ const r = this.editor.pencil.mList.getKey(this.material);
58533
+ r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
58534
+ }
58525
58535
  }
58526
58536
  }
58527
58537
  function parseTexture(g) {
@@ -58561,6 +58571,10 @@ const parseVideoTextures = (g, t) => {
58561
58571
  };
58562
58572
  function serializeMap(g) {
58563
58573
  if (g == null) return null;
58574
+ if (g.name === "PMREM.cubeUv")
58575
+ return {
58576
+ name: "PMREM.cubeUv"
58577
+ };
58564
58578
  const t = {
58565
58579
  geometries: {},
58566
58580
  materials: {},
@@ -58591,9 +58605,7 @@ class SetMaterialValue extends Command {
58591
58605
  super(t), this.type = "SetMaterialValue", this.name = `Set Material.${m}`, this.updatable = !0, this.object = r, this.materialSlot = C, this.material = this.editor.getObjectMaterial(r, C), this.oldValue = this.material !== void 0 ? this.material[m] : void 0, this.newValue = v, this.attributeName = m;
58592
58606
  }
58593
58607
  execute() {
58594
- this.material !== void 0 && (this.material[this.attributeName] = this.newValue, needsUpdateAttributeName.includes(this.attributeName) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material), setTimeout(() => {
58595
- this.attributeName === "name" && this.editor.emit("mListChange");
58596
- }));
58608
+ this.material !== void 0 && (this.material[this.attributeName] = this.newValue, needsUpdateAttributeName.includes(this.attributeName) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material), this.attributeName === "name" && this.editor.emit("mListChange"));
58597
58609
  }
58598
58610
  undo() {
58599
58611
  this.material[this.attributeName] = this.oldValue, needsUpdateAttributeName.includes(this.attributeName) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material), setTimeout(() => {
@@ -58613,6 +58625,13 @@ class SetMaterialValue extends Command {
58613
58625
  this.materialSlot
58614
58626
  );
58615
58627
  }
58628
+ fixJSON() {
58629
+ const t = this.json;
58630
+ if (this.material) {
58631
+ const r = this.editor.pencil.mList.getKey(this.material);
58632
+ r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
58633
+ }
58634
+ }
58616
58635
  }
58617
58636
  class SetMaterialVector extends Command {
58618
58637
  constructor(t, r, m, v, C) {
@@ -58637,6 +58656,13 @@ class SetMaterialVector extends Command {
58637
58656
  this.materialSlot
58638
58657
  ), this.attributeName = t.attributeName, this.oldValue = t.oldValue, this.newValue = t.newValue;
58639
58658
  }
58659
+ fixJSON() {
58660
+ const t = this.json;
58661
+ if (this.material) {
58662
+ const r = this.editor.pencil.mList.getKey(this.material);
58663
+ r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
58664
+ }
58665
+ }
58640
58666
  }
58641
58667
  class SetMaterialMapVector extends Command {
58642
58668
  constructor(t, r, m, v, C, _ = "repeat") {
@@ -58672,6 +58698,13 @@ class SetMaterialMapVector extends Command {
58672
58698
  this.materialSlot
58673
58699
  ), this.attributeName = t.attributeName, t.attributeName2 && (this.attributeName2 = t.attributeName2), this.oldValue = t.oldValue, this.newValue = t.newValue, this.attributeName === "repeat" && (this.attributeName = "map");
58674
58700
  }
58701
+ fixJSON() {
58702
+ const t = this.json;
58703
+ if (this.material) {
58704
+ const r = this.editor.pencil.mList.getKey(this.material);
58705
+ r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
58706
+ }
58707
+ }
58675
58708
  }
58676
58709
  class SetPosition extends Command {
58677
58710
  constructor(t, r, m, v, C) {
@@ -58760,11 +58793,13 @@ class SetValue extends Command {
58760
58793
  }
58761
58794
  fixObj() {
58762
58795
  const t = this.properties ? this.object[this.properties] : this.object;
58763
- t.isCamera && ["fov", "left", "right", "top", "bottom", "near", "far"].includes(
58796
+ if (t.isCamera && ["fov", "left", "right", "top", "bottom", "near", "far"].includes(
58764
58797
  this.attributeName
58765
- ) && t.updateProjectionMatrix(), setTimeout(() => {
58766
- (this.attributeName === "name" || this.attributeName === "prefab" || this.attributeName === "visible" || this.attributeName === "keepCamera") && this.editor.emit("baseObjectListChange");
58767
- });
58798
+ ) && t.updateProjectionMatrix(), this.attributeName === "visible") {
58799
+ const r = this.editor.pencil.lead.objMap.get(this.object);
58800
+ r && r[t[this.attributeName] ? "show" : "hide"]();
58801
+ }
58802
+ (this.attributeName === "name" || this.attributeName === "prefab" || this.attributeName === "visible" || this.attributeName === "keepCamera") && this.editor.emit("baseObjectListChange");
58768
58803
  }
58769
58804
  undo() {
58770
58805
  const t = this.properties ? this.object[this.properties] : this.object;
@@ -58927,26 +58962,37 @@ class AddMaterial extends Command {
58927
58962
  constructor(r, m) {
58928
58963
  super(r);
58929
58964
  L0(this, "materialType");
58965
+ L0(this, "flag", !1);
58930
58966
  L0(this, "addObjectUuid");
58931
58967
  this.type = "AddMaterial", this.name = "Add Material", this.materialType = m;
58932
58968
  }
58933
58969
  execute() {
58934
58970
  return H0(this, null, function* () {
58935
58971
  this.addObjectUuid = `material_${this.id}`;
58936
- const r = this.editor.pencil.mList, m = this.materialType === "MeshLineMaterial" ? new Te$1({
58972
+ const r = this.editor.pencil.mList;
58973
+ let m;
58974
+ if (this.materialType.startsWith("k:")) {
58975
+ const v = this.materialType.match(/k:([^|]+)\|s:([^|]+)/);
58976
+ if (v) {
58977
+ const C = v[1], _ = v[2], w = this.editor.pencil.lead.getObject(C);
58978
+ if (w) {
58979
+ const E = w.object3d;
58980
+ m = Array.isArray(E.material) ? E.material[+_] : E.material, this.flag = !0;
58981
+ } else
58982
+ console.warn(`Base object with key ${C} not found.`), m = new MeshBasicMaterial();
58983
+ } else
58984
+ console.warn(`Material type ${this.materialType} is not valid.`), m = new MeshBasicMaterial();
58985
+ } else this.materialType === "MeshLineMaterial" ? m = new Te$1({
58937
58986
  color: new Color$1(16777215),
58938
58987
  lineWidth: 1,
58939
58988
  sizeAttenuation: 0
58940
- }) : (
58941
- // @ts-ignore
58942
- new THREE[this.materialType]()
58943
- );
58944
- m.name = `材质_${this.id}`, r.add(this.addObjectUuid, m);
58989
+ }) : m = new THREE[this.materialType]();
58990
+ m.name = `材质_${this.id}`, r.add(this.addObjectUuid, m), this.flag && this.editor.emit("materialChanged");
58945
58991
  });
58946
58992
  }
58947
58993
  undo() {
58948
58994
  return H0(this, null, function* () {
58949
- this.editor.pencil.mList.remove(this.addObjectUuid);
58995
+ this.editor.pencil.mList.remove(this.addObjectUuid), this.flag && this.editor.emit("materialChanged");
58950
58996
  });
58951
58997
  }
58952
58998
  toJSON() {
@@ -59330,7 +59376,7 @@ class History {
59330
59376
  const Ne = parseInt(Pe.url.replace("$rp-", ""));
59331
59377
  Pe._url ? (Pe.url = Bi(Q0({}, Pe._url), {
59332
59378
  data: decodeUrlSafeBase64ToArrayBuffer(m[Ne])
59333
- }), delete Pe._url) : Pe.url = m[Ne], this.editor.playing || console.log("$rp-", Ne, E);
59379
+ }), delete Pe._url) : Pe.url = m[Ne];
59334
59380
  }
59335
59381
  });
59336
59382
  }
@@ -59372,7 +59418,7 @@ class History {
59372
59418
  return H0(this, null, function* () {
59373
59419
  t.fromJSON(t.json);
59374
59420
  try {
59375
- !["AddObject", "CopyMaterial", "RemoveMaterial"].includes(t.json.type) && t.json.objectUuid && !t.object || (yield t.execute(), t.fixJSON());
59421
+ !["AddObject", "CopyMaterial", "RemoveMaterial"].includes(t.json.type) && t.json.objectUuid && !t.object || (yield t.execute(), this.editor.playing || t.fixJSON());
59376
59422
  } catch (r) {
59377
59423
  console.error(r, t);
59378
59424
  }
@@ -59665,7 +59711,7 @@ function applyFixes(g, t) {
59665
59711
  version: "0.21.24",
59666
59712
  fix: () => {
59667
59713
  var _, w;
59668
- t.h.u[0] && t.h.u[0].visType === "map" && ((w = (_ = t.v) == null ? void 0 : _.eo) != null && w.parentBgCurvatureResolution) && (delete t.v.eo.parentBgCurvatureResolution, t.v.eo.parentBgTopSegments = 400);
59714
+ t.h.u[0] && t.h.u[0].visType === "map" && ((w = (_ = t.v) == null ? void 0 : _.eo) != null && w.parentBgCurvatureResolution) && delete t.v.eo.parentBgCurvatureResolution;
59669
59715
  }
59670
59716
  },
59671
59717
  {
@@ -141421,7 +141467,7 @@ const objs$1 = Bi(Q0({}, objs$3), {
141421
141467
  greyFull: g.options.greyFull
141422
141468
  // ...this.extendsOptions,
141423
141469
  // initCity: this.options.initCity,
141424
- }, g.options.parentBg && (g.extendsOptions.parentBgDepth = () => g.options.parentBgDepth, g.extendsOptions.parentBgTopSegments = () => g.options.parentBgTopSegments), g.loaderAdd = function() {
141470
+ }, g.options.parentBg && (g.extendsOptions.parentBgDepth = () => g.options.parentBgDepth), g.loaderAdd = function() {
141425
141471
  this.loader.add(["/image/map2/side.png"]);
141426
141472
  }, g.initMaterial = function() {
141427
141473
  return H0(this, null, function* () {
@@ -141679,7 +141725,7 @@ const objs$1 = Bi(Q0({}, objs$3), {
141679
141725
  continentsBg: !1,
141680
141726
  continentsBgDepth: 0,
141681
141727
  parentBgDepth: 0,
141682
- parentBgTopSegments: 0,
141728
+ topSegments: 0,
141683
141729
  clickHandleDrillDown: !1,
141684
141730
  drillDownSecondLevelMats: !1,
141685
141731
  drillDownFirstLevelUseBgMats: !1,
@@ -141724,7 +141770,7 @@ const objs$1 = Bi(Q0({}, objs$3), {
141724
141770
  }, r), {
141725
141771
  geojsonMap: m,
141726
141772
  extrudeLineGeojsonMap: v
141727
- })), this.options.equirectangular && (this.options.projectionType = "equirectangular"), this.options.winkel3 && (this.options.projectionType = "winkel3"), this.options.adcode === 0 ? this.extendsOptions.winkel3 = () => this.options.winkel3 : (this.getAdcodeShowLevel(this.options.adcode) === "province" || this.getAdcodeShowLevel(this.options.adcode) === "country") && (this.extendsOptions.clickHandleDrillDown = () => this.options.clickHandleDrillDown, this.options.clickHandleDrillDown && (this.workerOnce = !1, this.extendsOptions.mapDepth = () => Array.isArray(this.options.mapDepth) ? this.options.mapDepth : new Array(3).fill(this.options.mapDepth), this.extendsOptions.drillDownFirstLevelUseBgMats = () => this.options.drillDownFirstLevelUseBgMats, this.extendsOptions.drillDownSecondLevelMats = () => this.options.drillDownSecondLevelMats, this.extendsOptions.drillDownThirdLevelMats = () => this.options.drillDownThirdLevelMats, this.extendsOptions.drillDownPlateInCenter = () => this.options.drillDownPlateInCenter, this.extendsOptions.clickOusideBack = () => this.options.clickOusideBack, this.extendsOptions.handleBackKeepCamvasState = () => this.options.handleBackKeepCamvasState, this.extendsOptions.showOneLevel = () => this.options.showOneLevel, this.extendsOptions.showDistrict = () => this.options.showDistrict, this.options.parentBg && (this.extendsOptions.drillDownHideParent = () => this.options.drillDownHideParent)), this.extendsOptions.parentBg = () => this.options.parentBg, this.options.parentBg && (this.extendsOptions.parentBgDepth = () => this.options.parentBgDepth, this.extendsOptions.parentBgTopSegments = () => this.options.parentBgTopSegments), this.extendsOptions.continentsBg = () => this.options.continentsBg, this.options.continentsBg && (this.extendsOptions.continentsBgDepth = () => this.options.continentsBgDepth)), this.options.adcode === 0 ? world(this) : this.options.style === "map2Base" || this.options.style === "map2CityOnMap" ? base$1(this) : this.options.adcode === 1e5 ? china(this) : base$2(this);
141773
+ })), this.options.equirectangular && (this.options.projectionType = "equirectangular"), this.options.winkel3 && (this.options.projectionType = "winkel3"), this.options.adcode === 0 ? this.extendsOptions.winkel3 = () => this.options.winkel3 : (this.getAdcodeShowLevel(this.options.adcode) === "province" || this.getAdcodeShowLevel(this.options.adcode) === "country") && (this.extendsOptions.clickHandleDrillDown = () => this.options.clickHandleDrillDown, this.options.clickHandleDrillDown && (this.workerOnce = !1, this.extendsOptions.mapDepth = () => Array.isArray(this.options.mapDepth) ? this.options.mapDepth : new Array(3).fill(this.options.mapDepth), this.extendsOptions.drillDownFirstLevelUseBgMats = () => this.options.drillDownFirstLevelUseBgMats, this.extendsOptions.drillDownSecondLevelMats = () => this.options.drillDownSecondLevelMats, this.extendsOptions.drillDownThirdLevelMats = () => this.options.drillDownThirdLevelMats, this.extendsOptions.drillDownPlateInCenter = () => this.options.drillDownPlateInCenter, this.extendsOptions.clickOusideBack = () => this.options.clickOusideBack, this.extendsOptions.handleBackKeepCamvasState = () => this.options.handleBackKeepCamvasState, this.extendsOptions.showOneLevel = () => this.options.showOneLevel, this.extendsOptions.showDistrict = () => this.options.showDistrict, this.options.parentBg && (this.extendsOptions.drillDownHideParent = () => this.options.drillDownHideParent)), this.extendsOptions.parentBg = () => this.options.parentBg, this.options.parentBg && (this.extendsOptions.parentBgDepth = () => this.options.parentBgDepth), this.extendsOptions.continentsBg = () => this.options.continentsBg, this.options.continentsBg && (this.extendsOptions.continentsBgDepth = () => this.options.continentsBgDepth)), this.options.adcode === 0 ? world(this) : this.options.style === "map2Base" || this.options.style === "map2CityOnMap" ? base$1(this) : this.options.adcode === 1e5 ? china(this) : base$2(this);
141728
141774
  }
141729
141775
  handleSetting(r, m) {
141730
141776
  return H0(this, null, function* () {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.28.15";
1
+ declare const _default: "0.28.17";
2
2
  export default _default;
@@ -15,7 +15,7 @@ export interface MapOptions extends BaseOptions {
15
15
  center?: [number, number];
16
16
  parentBg?: boolean | number;
17
17
  parentBgDepth?: number;
18
- parentBgTopSegments?: number;
18
+ topSegments?: number;
19
19
  fixCity?: Record<number, number>;
20
20
  continentsBg?: boolean;
21
21
  continentsBgDepth?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.28.15",
3
+ "version": "0.28.17",
4
4
  "scripts": {
5
5
  "start": "npm run version && PORT=5173 bundler-dev",
6
6
  "build:site": "npm run version && PUBLIC_EXCLUDE=true bundler",
@@ -9,7 +9,6 @@
9
9
  "preview": "bundler-preview",
10
10
  "version": "node ./scripts/generate-version",
11
11
  "gzip": "node ./scripts/gzip",
12
- "getPublic": "node ./scripts/getPublic",
13
12
  "start:3dSite": "npm run version && VITE_SITE_3D=true bundler-dev",
14
13
  "build:3dSite": "npm run version && VITE_SITE_3D=true bundler",
15
14
  "pub": "npm publish"
@@ -1,2 +0,0 @@
1
- import Map from '../../index';
2
- export declare const map350000: (map: Map) => void;