vis-core 0.30.0-beta.59 → 0.30.0-beta.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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.module.js +71 -51
- package/dist/version.d.ts +1 -1
- package/dist/vis/map/MapManager.d.ts +3 -2
- package/package.json +2 -2
package/dist/index.module.js
CHANGED
|
@@ -63,7 +63,7 @@ import { continentsCountriesIso2 } from "geojson-cn";
|
|
|
63
63
|
Array.prototype.at || (Array.prototype.at = function(V) {
|
|
64
64
|
return V < 0 && (V = this.length + V), this[V];
|
|
65
65
|
});
|
|
66
|
-
const version = "0.30.0-beta.
|
|
66
|
+
const version = "0.30.0-beta.60", publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t", accessToken = {
|
|
67
67
|
token: void 0,
|
|
68
68
|
getInfo() {
|
|
69
69
|
if (!this.token)
|
|
@@ -57345,7 +57345,10 @@ class Qs {
|
|
|
57345
57345
|
enabled: !1,
|
|
57346
57346
|
throttleTime: 16,
|
|
57347
57347
|
// ~60fps
|
|
57348
|
-
viewportMargin: 50
|
|
57348
|
+
viewportMargin: 50,
|
|
57349
|
+
stabilityBonus: 50,
|
|
57350
|
+
// 当前显示的标签获得 +50 优先级加成
|
|
57351
|
+
fadeTime: 200
|
|
57349
57352
|
}, e);
|
|
57350
57353
|
}
|
|
57351
57354
|
/**
|
|
@@ -57409,23 +57412,28 @@ class Qs {
|
|
|
57409
57412
|
}
|
|
57410
57413
|
performCollisionDetection() {
|
|
57411
57414
|
const { padding: e, viewportMargin: n } = this.options, T = window.innerWidth, I = window.innerHeight, he = [];
|
|
57412
|
-
this.labels.forEach((
|
|
57413
|
-
const
|
|
57414
|
-
if (!ze) return;
|
|
57415
|
-
const Fe = ze.firstElementChild;
|
|
57415
|
+
this.labels.forEach((ze) => {
|
|
57416
|
+
const Fe = ze.node.element;
|
|
57416
57417
|
if (!Fe) return;
|
|
57417
|
-
const ke = Fe.
|
|
57418
|
-
|
|
57419
|
-
const Oe =
|
|
57420
|
-
|
|
57421
|
-
|
|
57422
|
-
|
|
57423
|
-
|
|
57424
|
-
|
|
57425
|
-
|
|
57426
|
-
|
|
57418
|
+
const ke = Fe.firstElementChild;
|
|
57419
|
+
if (!ke) return;
|
|
57420
|
+
const Oe = ke.style.opacity === "0";
|
|
57421
|
+
Oe && (ke.style.visibility = "hidden", ke.style.opacity = "1");
|
|
57422
|
+
const nt = ke.getBoundingClientRect();
|
|
57423
|
+
Oe && (ke.style.opacity = "0", ke.style.visibility = ""), !(nt.width === 0 || nt.height === 0) && (nt.right >= -n && nt.left <= T + n && nt.bottom >= -n && nt.top <= I + n ? (ze.bounds = nt, he.push(ze)) : (this.setNodeVisibility(ze.node, !1), ze.visible = !1));
|
|
57424
|
+
});
|
|
57425
|
+
const { stabilityBonus: fe } = this.options;
|
|
57426
|
+
he.sort((ze, Fe) => {
|
|
57427
|
+
const ke = ze.priority + (ze.visible ? fe : 0);
|
|
57428
|
+
return Fe.priority + (Fe.visible ? fe : 0) - ke;
|
|
57429
|
+
});
|
|
57430
|
+
const ve = [];
|
|
57431
|
+
for (const ze of he)
|
|
57432
|
+
ze.bounds && (this.checkCollision(
|
|
57433
|
+
ze.bounds,
|
|
57434
|
+
ve,
|
|
57427
57435
|
e
|
|
57428
|
-
) ? (this.setNodeVisibility(
|
|
57436
|
+
) ? (this.setNodeVisibility(ze.node, !1), ze.visible = !1) : (this.setNodeVisibility(ze.node, !0), ze.visible = !0, ve.push(ze.bounds)));
|
|
57429
57437
|
}
|
|
57430
57438
|
/**
|
|
57431
57439
|
* 检测矩形是否与已占用区域碰撞
|
|
@@ -57443,13 +57451,15 @@ class Qs {
|
|
|
57443
57451
|
return !(e.right + T < n.left || e.left - T > n.right || e.bottom + T < n.top || e.top - T > n.bottom);
|
|
57444
57452
|
}
|
|
57445
57453
|
/**
|
|
57446
|
-
*
|
|
57454
|
+
* 设置节点可见性(操作子元素,带淡入淡出)
|
|
57447
57455
|
*/
|
|
57448
57456
|
setNodeVisibility(e, n) {
|
|
57449
57457
|
const T = e.element;
|
|
57450
57458
|
if (!T) return;
|
|
57451
57459
|
const I = T.firstElementChild;
|
|
57452
|
-
|
|
57460
|
+
if (!I) return;
|
|
57461
|
+
const { fadeTime: he } = this.options;
|
|
57462
|
+
he > 0 && !I.style.transition && (I.style.transition = `opacity ${he}ms ease-out`), n ? I.style.opacity = "1" : I.style.opacity = "0";
|
|
57453
57463
|
}
|
|
57454
57464
|
/**
|
|
57455
57465
|
* 获取当前可见的标签数量
|
|
@@ -145648,6 +145658,7 @@ class MapManager {
|
|
|
145648
145658
|
C0(this, "mapPadding");
|
|
145649
145659
|
C0(this, "isInitializing", !1);
|
|
145650
145660
|
C0(this, "rmTemplateIdentifier");
|
|
145661
|
+
C0(this, "geojsonExtensions", {});
|
|
145651
145662
|
// 分组管理
|
|
145652
145663
|
C0(this, "groups", {});
|
|
145653
145664
|
// 事件处理器
|
|
@@ -145655,7 +145666,13 @@ class MapManager {
|
|
|
145655
145666
|
// 定时器管理
|
|
145656
145667
|
C0(this, "areaCloseTimer", null);
|
|
145657
145668
|
var n;
|
|
145658
|
-
this.container = e.container, this.controlsContainer = e.controlsContainer || e.container, this.assetsPrefix = e.assetsPrefix, this.fixConfig = e.fixConfig, this.raycasterPointsThreshold = e.raycasterPointsThreshold || 5e-3, this.mapPadding = e.mapPadding || [0, 0, 0, 0], this.rmTemplateIdentifier = (n = e.rmTemplateIdentifier) != null ? n : !1
|
|
145669
|
+
this.container = e.container, this.controlsContainer = e.controlsContainer || e.container, this.assetsPrefix = e.assetsPrefix, this.fixConfig = e.fixConfig, this.raycasterPointsThreshold = e.raycasterPointsThreshold || 5e-3, this.mapPadding = e.mapPadding || [0, 0, 0, 0], this.rmTemplateIdentifier = (n = e.rmTemplateIdentifier) != null ? n : !1, e.geojsonExtensions && Object.entries(e.geojsonExtensions).forEach(([T, I]) => {
|
|
145670
|
+
this.geojsonExtensions[T] = [], I.forEach((he) => {
|
|
145671
|
+
extendsAdcodeAll((fe) => {
|
|
145672
|
+
fe[he.adcode] = he, fe[T].c.push(he.adcode), this.geojsonExtensions[T].push(he.adcode);
|
|
145673
|
+
});
|
|
145674
|
+
});
|
|
145675
|
+
});
|
|
145659
145676
|
}
|
|
145660
145677
|
/**
|
|
145661
145678
|
* 设置事件处理器
|
|
@@ -145692,7 +145709,7 @@ class MapManager {
|
|
|
145692
145709
|
const T = e.at(-1) || e.at(-2);
|
|
145693
145710
|
if (!T) return null;
|
|
145694
145711
|
try {
|
|
145695
|
-
|
|
145712
|
+
this.isInitializing = !0, yield this.createMapInstance(T, n);
|
|
145696
145713
|
} finally {
|
|
145697
145714
|
this.isInitializing = !1;
|
|
145698
145715
|
}
|
|
@@ -145730,7 +145747,7 @@ class MapManager {
|
|
|
145730
145747
|
nt.h.u[0].visOptions,
|
|
145731
145748
|
nt.h.i
|
|
145732
145749
|
);
|
|
145733
|
-
he != null && he.c.length && (at.showBuilding = !1), nt.h.u[0].visOptions = at;
|
|
145750
|
+
this.geojsonExtensions && (at.geojsonExtensions = this.geojsonExtensions), he != null && he.c.length && (at.showBuilding = !1), nt.h.u[0].visOptions = at;
|
|
145734
145751
|
}
|
|
145735
145752
|
return nt;
|
|
145736
145753
|
}),
|
|
@@ -145765,39 +145782,42 @@ class MapManager {
|
|
|
145765
145782
|
* 绑定区域交互事件
|
|
145766
145783
|
*/
|
|
145767
145784
|
bindAreaEvents(e) {
|
|
145768
|
-
const n = {};
|
|
145769
|
-
e.
|
|
145770
|
-
|
|
145771
|
-
|
|
145772
|
-
|
|
145773
|
-
|
|
145774
|
-
|
|
145775
|
-
|
|
145776
|
-
|
|
145777
|
-
|
|
145778
|
-
|
|
145779
|
-
|
|
145780
|
-
|
|
145781
|
-
|
|
145782
|
-
|
|
145785
|
+
const n = {}, T = e.options.geojsonExtensions && Object.values(e.options.geojsonExtensions).flat();
|
|
145786
|
+
T && e.map.groupArr.forEach((I) => {
|
|
145787
|
+
T.includes(I.userData.adcode) && (I.position.z += 1e-3);
|
|
145788
|
+
}), e.mapArea.forEach((I) => {
|
|
145789
|
+
var ve;
|
|
145790
|
+
const he = I.userData.adcode;
|
|
145791
|
+
I.lead.enableCursor(I);
|
|
145792
|
+
const fe = e.cityVis.length === 1 ? e.cityVis[0] : e.cityVis.find((ze) => ze.options.adcode === he);
|
|
145793
|
+
if (fe) {
|
|
145794
|
+
const ze = (ve = n[fe.options.adcode]) != null ? ve : fe.group.getSize().max.z;
|
|
145795
|
+
n[fe.options.adcode] = ze;
|
|
145796
|
+
}
|
|
145797
|
+
I.onPointerEnter(({ mouseEvent: ze }) => {
|
|
145798
|
+
if (this.clearAreaCloseTimer(), I.useMListByName("顶面高亮", 0), fe && (I.position.z = n[fe.options.adcode] - e.mapObj.depth), !(I.userData.centroid || I.userData.center)) return;
|
|
145799
|
+
const { max: ke, center: Oe } = I.getSize(), nt = e.getScreenPosition(
|
|
145800
|
+
Oe.x,
|
|
145801
|
+
Oe.y,
|
|
145802
|
+
ke.z
|
|
145783
145803
|
);
|
|
145784
145804
|
this.emit("areaHover", {
|
|
145785
|
-
areaName:
|
|
145786
|
-
x:
|
|
145787
|
-
y:
|
|
145788
|
-
mouseLeft:
|
|
145789
|
-
mouseTop:
|
|
145805
|
+
areaName: I.userData.name,
|
|
145806
|
+
x: nt.x,
|
|
145807
|
+
y: nt.y,
|
|
145808
|
+
mouseLeft: ze.clientX,
|
|
145809
|
+
mouseTop: ze.clientY
|
|
145790
145810
|
});
|
|
145791
|
-
}),
|
|
145811
|
+
}), I.onPointerMove(() => {
|
|
145792
145812
|
this.clearAreaCloseTimer();
|
|
145793
|
-
}),
|
|
145794
|
-
|
|
145795
|
-
areaName:
|
|
145813
|
+
}), I.onPointerLeave(() => {
|
|
145814
|
+
I.useMListByName("顶面", 0), fe && (I.position.z = 0), this.triggerAreaLeave({
|
|
145815
|
+
areaName: I.userData.name
|
|
145796
145816
|
});
|
|
145797
|
-
}),
|
|
145798
|
-
|
|
145799
|
-
areaName:
|
|
145800
|
-
adcode:
|
|
145817
|
+
}), I.onClick(() => {
|
|
145818
|
+
I.useMListByName("顶面", 0), fe && (I.position.z = 0), this.emit("areaClick", {
|
|
145819
|
+
areaName: I.userData.name,
|
|
145820
|
+
adcode: I.userData.adcode
|
|
145801
145821
|
});
|
|
145802
145822
|
});
|
|
145803
145823
|
});
|
|
@@ -145869,7 +145889,7 @@ class MapManager {
|
|
|
145869
145889
|
}), this.mapInstances = {}, this.currentMap = null, Editor.clearUrlCache();
|
|
145870
145890
|
}
|
|
145871
145891
|
}
|
|
145872
|
-
C0(MapManager, "findAdcodeInfoByName", findAdcodeInfoByName), C0(MapManager, "getAdcodeShowLevel", getAdcodeShowLevel), C0(MapManager, "findAdcodeInfo", findAdcodeInfo)
|
|
145892
|
+
C0(MapManager, "findAdcodeInfoByName", findAdcodeInfoByName), C0(MapManager, "getAdcodeShowLevel", getAdcodeShowLevel), C0(MapManager, "findAdcodeInfo", findAdcodeInfo);
|
|
145873
145893
|
const access = {
|
|
145874
145894
|
set token(V) {
|
|
145875
145895
|
accessToken.token = V;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.30.0-beta.
|
|
1
|
+
declare const _default: "0.30.0-beta.60";
|
|
2
2
|
export default _default;
|
|
@@ -13,6 +13,7 @@ export interface MapManagerConfig {
|
|
|
13
13
|
raycasterPointsThreshold?: number;
|
|
14
14
|
mapPadding?: [number, number, number, number];
|
|
15
15
|
rmTemplateIdentifier?: boolean;
|
|
16
|
+
geojsonExtensions?: Record<string, any[]>;
|
|
16
17
|
}
|
|
17
18
|
export interface MapEventHandlers {
|
|
18
19
|
[key: string]: (...args: any[]) => void;
|
|
@@ -36,6 +37,7 @@ export declare class MapManager {
|
|
|
36
37
|
private mapPadding;
|
|
37
38
|
private isInitializing;
|
|
38
39
|
private rmTemplateIdentifier;
|
|
40
|
+
private geojsonExtensions;
|
|
39
41
|
private groups;
|
|
40
42
|
private eventHandlers;
|
|
41
43
|
private areaCloseTimer;
|
|
@@ -60,7 +62,6 @@ export declare class MapManager {
|
|
|
60
62
|
c: number[];
|
|
61
63
|
b: number[];
|
|
62
64
|
} | undefined;
|
|
63
|
-
static extendsAdcodeAll: (cb: any) => void;
|
|
64
65
|
constructor(config: MapManagerConfig);
|
|
65
66
|
/**
|
|
66
67
|
* 设置事件处理器
|
|
@@ -81,7 +82,7 @@ export declare class MapManager {
|
|
|
81
82
|
/**
|
|
82
83
|
* 初始化地图
|
|
83
84
|
*/
|
|
84
|
-
initMap(adcodeArr: number[], fixedAdcode?: boolean): Promise<Map | null>;
|
|
85
|
+
initMap(adcodeArr: number[], fixedAdcode?: boolean): Promise<Map | null | undefined>;
|
|
85
86
|
/**
|
|
86
87
|
* 创建地图实例
|
|
87
88
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vis-core",
|
|
3
|
-
"version": "0.30.0-beta.
|
|
3
|
+
"version": "0.30.0-beta.60",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "npm run version && PORT=5174 bundler-dev",
|
|
6
6
|
"build:site": "npm run version && PUBLIC_EXCLUDE=true bundler",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"esus-lite": "^0.2.8",
|
|
65
65
|
"events": "^3.3.0",
|
|
66
66
|
"geojson-cn": "^0.2.5",
|
|
67
|
-
"gl-draw": "0.17.0-beta.
|
|
67
|
+
"gl-draw": "0.17.0-beta.43",
|
|
68
68
|
"jsrsasign": "^11.1.0",
|
|
69
69
|
"lodash-es": "^4.17.21"
|
|
70
70
|
},
|