vis-core 0.21.9 → 0.21.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.
@@ -37242,6 +37242,11 @@ class MaterialList {
37242
37242
  emitObject3dChange() {
37243
37243
  this.pencil.event.emit("object3dListChange");
37244
37244
  }
37245
+ setObject3dMeta(e, s) {
37246
+ this.objectList.forEach((h, Y) => {
37247
+ h.key === e && this.objectList.set(Y, xi(xi({}, h), s));
37248
+ });
37249
+ }
37245
37250
  setObject3d(e, s, h) {
37246
37251
  if (this.objectList.has(e) && console.warn(`ObjectList: ${e.uuid} already exists`), !(h != null && h.disableCheckHide)) {
37247
37252
  const Y = e.material;
@@ -47192,7 +47197,7 @@ function createAreaLightMaterial(c) {
47192
47197
  const e = new MeshBasicMaterial();
47193
47198
  return e.color.setScalar(c), e;
47194
47199
  }
47195
- const version = "0.21.9";
47200
+ const version = "0.21.11";
47196
47201
  class Event {
47197
47202
  constructor() {
47198
47203
  F0(this, "event", new EventEmitter());
@@ -49182,7 +49187,7 @@ class ContinentsBg extends D$1 {
49182
49187
  create() {
49183
49188
  return $0(this, null, function* () {
49184
49189
  const { depth: s } = this.options, h = this.pencil.installPlugins.get("materialList"), Y = this.pencil.getPlugin("draw"), Ge = h.getMaterialObj("continents");
49185
- this.createGroup(), yield Promise.all(
49190
+ this.createGroup(), this.object3d.name = "大洲组", yield Promise.all(
49186
49191
  continents.features.map((We) => $0(this, null, function* () {
49187
49192
  const Re = We.properties.name;
49188
49193
  Re === "大洋洲" && (We.geometry.coordinates[4] = [], We.geometry.coordinates[21] = []);
@@ -49242,8 +49247,13 @@ class ContinentsBg extends D$1 {
49242
49247
  }), this.mapArr.forEach((h) => {
49243
49248
  s.setObject3d(h.object3d, "continents-" + h.userData.name, {
49244
49249
  baseObject: h,
49245
- remove: !1
49250
+ remove: !1,
49251
+ parent: this.object3d
49246
49252
  });
49253
+ }), s.setObject3dMeta("continentsArea", {
49254
+ parent: this.object3d
49255
+ }), s.setObject3dMeta("continentsLine", {
49256
+ parent: this.object3d
49247
49257
  });
49248
49258
  }
49249
49259
  dispose() {
@@ -49730,10 +49740,10 @@ const objs$4 = sn(xi({}, objs$5), {
49730
49740
  "continentsArea",
49731
49741
  ["continents#topMat", "continents#sideMat"],
49732
49742
  {
49733
- name: "大洲"
49743
+ name: "板块材质"
49734
49744
  }
49735
49745
  ), this.mList.setShowMaterialList("continentsLine", "continents#lineMat", {
49736
- name: "大洲线"
49746
+ name: "线材质"
49737
49747
  });
49738
49748
  }
49739
49749
  });
@@ -49931,7 +49941,13 @@ const objs$4 = sn(xi({}, objs$5), {
49931
49941
  getDepth(s) {
49932
49942
  const h = this.getAdcodeShowLevel(s);
49933
49943
  let Y = this.options.mapDepth;
49934
- return Array.isArray(Y) || (Y = new Array(3).fill(Y)), h === "country" ? Y[0] : h === "province" ? Y[1] : Y[2];
49944
+ Array.isArray(Y) || (Y = new Array(3).fill(Y));
49945
+ let Ge;
49946
+ if (h === "country" ? Ge = Y[0] : h === "province" ? Ge = Y[1] : Ge = Y[2], this.options.depthReference && this.options.bboxMap[s]) {
49947
+ const We = this.options.depthReference, Re = this.options.bboxMap[s], Le = Math.abs(Re[3] - Re[1]) / Math.abs(We[3] - We[1]), ve = Math.abs(Re[2] - Re[0]) / Math.abs(We[2] - We[0]);
49948
+ Ge = Ge * Math.max(Le, ve);
49949
+ }
49950
+ return Ge;
49935
49951
  }
49936
49952
  getAdcodeShowLevel(s) {
49937
49953
  var h;
@@ -53132,7 +53148,7 @@ function stringToUtf8ByteArray(c) {
53132
53148
  }
53133
53149
  let b = "/";
53134
53150
  b === "/" && (b = "");
53135
- const getMapConfig = (s, ...h) => $0(void 0, [s, ...h], function* (c, e = b) {
53151
+ const getMapConfig = (h, ...Y) => $0(void 0, [h, ...Y], function* (c, e = b, s) {
53136
53152
  if (c === 0)
53137
53153
  return {
53138
53154
  mapDepth: 5,
@@ -53142,94 +53158,98 @@ const getMapConfig = (s, ...h) => $0(void 0, [s, ...h], function* (c, e = b) {
53142
53158
  center: [0, 0]
53143
53159
  };
53144
53160
  {
53145
- const Y = adcodeMap[c];
53161
+ const Ge = adcodeMap[c];
53146
53162
  return extendMapConfig(
53147
53163
  "map",
53148
53164
  {
53149
- center: [Y.lng, Y.lat],
53150
- adcode: Y.adcode
53165
+ center: [Ge.lng, Ge.lat],
53166
+ adcode: Ge.adcode
53151
53167
  },
53152
- e
53168
+ e,
53169
+ s
53153
53170
  );
53154
53171
  }
53155
- }), getMap2Config = (s, ...h) => $0(void 0, [s, ...h], function* (c, e = b) {
53156
- const Y = adcodeMap[c];
53172
+ }), getMap2Config = (h, ...Y) => $0(void 0, [h, ...Y], function* (c, e = b, s) {
53173
+ const Ge = adcodeMap[c];
53157
53174
  return extendMapConfig(
53158
53175
  "map2",
53159
53176
  {
53160
- center: [Y.lng, Y.lat],
53161
- adcode: Y.adcode,
53162
- parentBg: Y.adcode !== 1e5
53177
+ center: [Ge.lng, Ge.lat],
53178
+ adcode: Ge.adcode,
53179
+ parentBg: Ge.adcode !== 1e5
53163
53180
  },
53164
- e
53181
+ e,
53182
+ s
53165
53183
  );
53166
- }), getMap2WithCityConfig = (s, ...h) => $0(void 0, [s, ...h], function* (c, e = b) {
53167
- const Y = adcodeMap[c];
53184
+ }), getMap2WithCityConfig = (h, ...Y) => $0(void 0, [h, ...Y], function* (c, e = b, s) {
53185
+ const Ge = adcodeMap[c];
53168
53186
  return extendMapConfig(
53169
53187
  "map2",
53170
53188
  {
53171
- center: [Y.lng, Y.lat],
53172
- adcode: Y.adcode,
53189
+ center: [Ge.lng, Ge.lat],
53190
+ adcode: Ge.adcode,
53173
53191
  showOneLevel: !0,
53174
- allCity: Y.level === "province",
53192
+ allCity: Ge.level === "province",
53175
53193
  cityOnMap: !0,
53176
53194
  parentBg: !1,
53177
53195
  mapDepth: 4e-3,
53178
53196
  bottomPlane: !1
53179
53197
  },
53180
- e
53198
+ e,
53199
+ s
53181
53200
  );
53182
- }), extendMapConfig = (h, Y, ...Ge) => $0(void 0, [h, Y, ...Ge], function* (c, e, s = b) {
53183
- var We, Re;
53201
+ }), extendMapConfig = (Y, Ge, ...We) => $0(void 0, [Y, Ge, ...We], function* (c, e, s = b, h) {
53202
+ var Re, Le;
53184
53203
  if (e.adcode !== 0 && e.adcode !== 1e5) {
53185
- const Le = (We = e.fixGeojson) == null ? void 0 : We[e.adcode], ve = (Re = e.fixGeojson) == null ? void 0 : Re[e.adcode + "-lite"];
53186
- let { res: Ie } = yield jsonFetch(
53187
- s + `/geojson/${Le || "json"}/${e.adcode}.json`
53204
+ const ve = (Re = e.fixGeojson) == null ? void 0 : Re[e.adcode], Ie = (Le = e.fixGeojson) == null ? void 0 : Le[e.adcode + "-lite"];
53205
+ let { res: Te } = yield jsonFetch(
53206
+ s + `/geojson/${ve || "json"}/${e.adcode}.json`
53188
53207
  );
53189
- const { res: Te } = yield jsonFetch(
53190
- s + `/geojson/${ve || "json-lite"}/${e.adcode}.json`
53191
- ), ke = bbox(Te), ze = e.adcode, je = sn(xi({}, e), {
53208
+ const { res: ke } = yield jsonFetch(
53209
+ s + `/geojson/${Ie || "json-lite"}/${e.adcode}.json`
53210
+ ), ze = bbox(ke), je = e.adcode, pt = sn(xi({}, e), {
53192
53211
  geojsonMap: {
53193
- [ze]: Ie
53212
+ [je]: Te
53194
53213
  },
53195
53214
  extrudeLineGeojsonMap: {
53196
- [ze]: Te
53215
+ [je]: ke
53197
53216
  },
53198
53217
  bboxMap: {
53199
- [ze]: ke
53218
+ [je]: ze
53200
53219
  },
53201
53220
  cityBboxMap: {},
53202
- jsonNameObj: {}
53221
+ jsonNameObj: {},
53222
+ depthReference: void 0
53203
53223
  });
53204
53224
  if (c === "map2") {
53205
- if (!(adcodeMap[ze].level === "province")) {
53206
- let nt = adcodeMap[ze].parent;
53207
- for (; adcodeMap[nt].level !== "province"; )
53208
- nt = adcodeMap[nt].parent;
53209
- const { res: Be } = yield jsonFetch(
53210
- s + `/geojson/${Le || "json"}/${nt}.json`
53225
+ if (!(adcodeMap[je].level === "province")) {
53226
+ let Be = adcodeMap[je].parent;
53227
+ for (; adcodeMap[Be].level !== "province"; )
53228
+ Be = adcodeMap[Be].parent;
53229
+ const { res: at } = yield jsonFetch(
53230
+ s + `/geojson/${ve || "json"}/${Be}.json`
53211
53231
  );
53212
- Ie = Be;
53232
+ Te = at;
53213
53233
  }
53214
- Ie.features.forEach((nt) => {
53215
- je.cityBboxMap[nt.properties.adcode] = bbox(nt), je.jsonNameObj[nt.properties.adcode] = ec(
53216
- nt.properties.name,
53217
- `${nt.properties.adcode}`
53234
+ Te.features.forEach((Be) => {
53235
+ pt.cityBboxMap[Be.properties.adcode] = bbox(Be), pt.jsonNameObj[Be.properties.adcode] = ec(
53236
+ Be.properties.name,
53237
+ `${Be.properties.adcode}`
53218
53238
  );
53219
53239
  });
53220
53240
  }
53221
53241
  if (e.parentBg) {
53222
- const pt = adcodeMap[ze].parent;
53223
- if (pt !== 1e5) {
53224
- const { res: nt } = yield jsonFetch(
53225
- s + `/geojson/json/${pt}.json`
53226
- ), { res: Be } = yield jsonFetch(
53227
- s + `/geojson/json-lite/${pt}.json`
53242
+ const nt = adcodeMap[je].parent;
53243
+ if (nt !== 1e5) {
53244
+ const { res: Be } = yield jsonFetch(
53245
+ s + `/geojson/json/${nt}.json`
53246
+ ), { res: at } = yield jsonFetch(
53247
+ s + `/geojson/json-lite/${nt}.json`
53228
53248
  );
53229
- je.geojsonMap[pt] = nt, je.extrudeLineGeojsonMap[pt] = Be, je.bboxMap[pt] = bbox(Be);
53249
+ pt.geojsonMap[nt] = Be, pt.extrudeLineGeojsonMap[nt] = at, pt.bboxMap[nt] = bbox(at);
53230
53250
  }
53231
53251
  }
53232
- return je;
53252
+ return h && (pt.depthReference = h.depthReference || h.bboxMap[h.adcode]), pt;
53233
53253
  }
53234
53254
  return xi({}, e);
53235
53255
  }), getCityConfig = (s, ...h) => $0(void 0, [s, ...h], function* (c, e = b) {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.21.9";
1
+ declare const _default: "0.21.11";
2
2
  export default _default;
@@ -32,6 +32,7 @@ export default class MaterialList {
32
32
  }): void;
33
33
  getValidShowObjectListArr(): Meta[];
34
34
  emitObject3dChange(): void;
35
+ setObject3dMeta(key: string, meta: ObjectMeta): void;
35
36
  setObject3d(object3d: THREE.Object3D, key: string, meta?: ObjectMeta & {
36
37
  disableCheckHide?: boolean;
37
38
  }): void;
@@ -20,6 +20,7 @@ export interface MapOptions extends BaseOptions {
20
20
  continentsBgDepth?: number;
21
21
  clickOusideBack?: boolean;
22
22
  mapDepth?: number[];
23
+ depthReference?: number[];
23
24
  mapPadding?: number[];
24
25
  geojsonMap?: Record<string, GeoJSON>;
25
26
  extrudeLineGeojsonMap?: Record<string, GeoJSON>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.21.9",
3
+ "version": "0.21.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",