gis-common 3.1.11 → 3.1.12
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/gis-common.es.js +547 -526
- package/dist/gis-common.umd.js +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/utils/ArrayUtils.d.ts +9 -0
- package/dist/utils/BrowserUtils.d.ts +41 -0
- package/package.json +1 -1
package/dist/gis-common.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var z = Object.defineProperty;
|
|
2
2
|
var H = (e, t, n) => t in e ? z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var f = (e, t, n) => H(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
const
|
|
4
|
+
const b = {
|
|
5
5
|
MAP_RENDER: "mapRender",
|
|
6
6
|
MAP_READY: "mapReady",
|
|
7
7
|
MOUSE_CLICK: "click",
|
|
@@ -58,7 +58,7 @@ const x = {
|
|
|
58
58
|
// addS3MGroupLayer(url, options, index) 添加S3M分组图层。
|
|
59
59
|
TERRAIN_LAYER: "TerrainFileLayer"
|
|
60
60
|
// 地形图层, 需要单独处理
|
|
61
|
-
},
|
|
61
|
+
}, V = {
|
|
62
62
|
POINT: "point",
|
|
63
63
|
POLYLINE: "polyline",
|
|
64
64
|
POLYGON: "polygon",
|
|
@@ -68,7 +68,7 @@ const x = {
|
|
|
68
68
|
LABEL: "label",
|
|
69
69
|
MODEL: "model",
|
|
70
70
|
WALL: "wall"
|
|
71
|
-
},
|
|
71
|
+
}, X = {
|
|
72
72
|
DISTANCE: "distance",
|
|
73
73
|
AREA: "area",
|
|
74
74
|
HEIGHT: "height"
|
|
@@ -76,35 +76,33 @@ const x = {
|
|
|
76
76
|
ADD: "add",
|
|
77
77
|
REMOVE: "remove",
|
|
78
78
|
INIT: "init"
|
|
79
|
-
}
|
|
79
|
+
};
|
|
80
|
+
class tt {
|
|
81
|
+
constructor(t) {
|
|
82
|
+
/**
|
|
83
|
+
* Creates an instance of AudioPlayer.
|
|
84
|
+
* @param {*} url
|
|
85
|
+
*/
|
|
86
|
+
f(this, "audio");
|
|
87
|
+
this.audio = new Audio(), this.audio.src = t;
|
|
88
|
+
}
|
|
89
|
+
play() {
|
|
90
|
+
!this.muted && this.audio.play();
|
|
91
|
+
}
|
|
92
|
+
pause() {
|
|
93
|
+
this.audio.pause();
|
|
94
|
+
}
|
|
95
|
+
get muted() {
|
|
96
|
+
return this.audio.muted;
|
|
97
|
+
}
|
|
80
98
|
/**
|
|
81
|
-
*
|
|
82
|
-
* @param {*} ele 需要运动的节点
|
|
83
|
-
* @param {*} attr_options 传入的是一个需要运动的属性包括运动的目标值,操作的节点属性
|
|
84
|
-
* @param {*} timefn 运动的形式,默认是缓冲运动
|
|
85
|
-
* @param {*} speed 运动的速度
|
|
99
|
+
* @description 设置静音状态,如果静音,autoplay属性将失效
|
|
86
100
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
t[r] = {
|
|
90
|
-
target: r === "opacity" ? parseInt(t[r] * 100) : t[r],
|
|
91
|
-
// 需要计算得到
|
|
92
|
-
iNow: parseInt(r === "opacity" ? getComputedStyle(e)[r] * 100 : getComputedStyle(e)[r])
|
|
93
|
-
};
|
|
94
|
-
s === "liner" && (a = t[r].iNow < t[r].target ? Math.abs(a) : -Math.abs(a)), clearInterval(e.timer), e.timer = setInterval(function() {
|
|
95
|
-
for (var i in t) {
|
|
96
|
-
var o = t[i].target, c = t[i].iNow;
|
|
97
|
-
if (s === "swing" && (a = (o - c) / 20, a = a > 0 ? Math.ceil(a) : Math.floor(a)), Math.abs(o - c) <= Math.abs(a)) {
|
|
98
|
-
i === "opacity" ? e.style[i] = o / 100 : e.style[i] = o + "px", delete t[i];
|
|
99
|
-
for (var l in t)
|
|
100
|
-
return !1;
|
|
101
|
-
clearInterval(e.timer), typeof n == "function" && n();
|
|
102
|
-
} else
|
|
103
|
-
t[i].iNow += a, i === "opacity" ? e.style[i] = t[i].iNow / 100 : e.style[i] = t[i].iNow + "px";
|
|
104
|
-
}
|
|
105
|
-
}, 30);
|
|
101
|
+
set muted(t) {
|
|
102
|
+
this.audio.muted = t;
|
|
106
103
|
}
|
|
107
|
-
}
|
|
104
|
+
}
|
|
105
|
+
const E = {
|
|
108
106
|
/**
|
|
109
107
|
* 获取数据类型
|
|
110
108
|
*
|
|
@@ -148,8 +146,8 @@ const x = {
|
|
|
148
146
|
json2Query(e) {
|
|
149
147
|
var t = [];
|
|
150
148
|
for (var n in e) {
|
|
151
|
-
var s = n,
|
|
152
|
-
t.push(s + "=" +
|
|
149
|
+
var s = n, i = e[n];
|
|
150
|
+
t.push(s + "=" + i);
|
|
153
151
|
}
|
|
154
152
|
var r = t.join("&");
|
|
155
153
|
return r;
|
|
@@ -176,8 +174,8 @@ const x = {
|
|
|
176
174
|
if (e.length > 1) {
|
|
177
175
|
const n = e.slice(1, e.length % 2 === 0 ? e.length - 1 : e.length);
|
|
178
176
|
for (let s = 0; s < n.length; s = s + 2) {
|
|
179
|
-
const
|
|
180
|
-
e[0] ===
|
|
177
|
+
const i = n[s];
|
|
178
|
+
e[0] === i && (t = n[s + 1]);
|
|
181
179
|
}
|
|
182
180
|
!t && e.length % 2 === 0 && (t = e[e.length - 1]);
|
|
183
181
|
} else
|
|
@@ -192,8 +190,8 @@ const x = {
|
|
|
192
190
|
* @returns 返回目标对象,包含所有复制的属性。
|
|
193
191
|
*/
|
|
194
192
|
extend(e, ...t) {
|
|
195
|
-
let n, s,
|
|
196
|
-
for (s = 0,
|
|
193
|
+
let n, s, i, r;
|
|
194
|
+
for (s = 0, i = t.length; s < i; s++) {
|
|
197
195
|
r = t[s];
|
|
198
196
|
for (n in r)
|
|
199
197
|
e[n] = r[n];
|
|
@@ -220,14 +218,14 @@ const x = {
|
|
|
220
218
|
* @returns 转换后的树形结构数组
|
|
221
219
|
*/
|
|
222
220
|
convertToTree2(e, t = "id", n = "parentId", s = "children") {
|
|
223
|
-
const
|
|
224
|
-
function r(
|
|
225
|
-
const o = e.filter((c) => c[n] ===
|
|
226
|
-
o.length > 0 && (
|
|
221
|
+
const i = [];
|
|
222
|
+
function r(a) {
|
|
223
|
+
const o = e.filter((c) => c[n] === a[t]).map((c) => (i.some((l) => l[t] === c[t]) || r(c), c));
|
|
224
|
+
o.length > 0 && (a[s] = o);
|
|
227
225
|
}
|
|
228
|
-
return e.forEach((
|
|
229
|
-
e.some((o) => o[n] ===
|
|
230
|
-
}),
|
|
226
|
+
return e.forEach((a) => {
|
|
227
|
+
e.some((o) => o[n] === a[t]) || (r(a), i.push(a));
|
|
228
|
+
}), i;
|
|
231
229
|
},
|
|
232
230
|
/**
|
|
233
231
|
* 异步加载script
|
|
@@ -274,8 +272,8 @@ const x = {
|
|
|
274
272
|
*/
|
|
275
273
|
template(e, t) {
|
|
276
274
|
const n = /\{ *([\w_-]+) *\}/g;
|
|
277
|
-
return e.replace(n, (s,
|
|
278
|
-
const r = t[
|
|
275
|
+
return e.replace(n, (s, i) => {
|
|
276
|
+
const r = t[i];
|
|
279
277
|
if (r === void 0)
|
|
280
278
|
throw new Error(`${p.JSON_VALUE_ERROR}: ${s}`);
|
|
281
279
|
return typeof r == "function" ? r(t) : r;
|
|
@@ -322,6 +320,347 @@ const x = {
|
|
|
322
320
|
});
|
|
323
321
|
}
|
|
324
322
|
}
|
|
323
|
+
}, g = {
|
|
324
|
+
DEG2RAD: Math.PI / 180,
|
|
325
|
+
RAD2DEG: 180 / Math.PI,
|
|
326
|
+
randInt(e, t) {
|
|
327
|
+
return e + Math.floor(Math.random() * (t - e + 1));
|
|
328
|
+
},
|
|
329
|
+
randFloat(e, t) {
|
|
330
|
+
return e + Math.random() * (t - e);
|
|
331
|
+
},
|
|
332
|
+
/**
|
|
333
|
+
* 角度转弧度
|
|
334
|
+
*
|
|
335
|
+
* @param {*} degrees
|
|
336
|
+
* @returns {*}
|
|
337
|
+
*/
|
|
338
|
+
degreesToRadians(e) {
|
|
339
|
+
return e * this.DEG2RAD;
|
|
340
|
+
},
|
|
341
|
+
/**
|
|
342
|
+
* 角度转弧度
|
|
343
|
+
*
|
|
344
|
+
* @param {*} degrees
|
|
345
|
+
* @returns {*}
|
|
346
|
+
*/
|
|
347
|
+
toRadians(e) {
|
|
348
|
+
return e * this.DEG2RAD;
|
|
349
|
+
},
|
|
350
|
+
/**
|
|
351
|
+
* 弧度转角度
|
|
352
|
+
*
|
|
353
|
+
* @param {*} radians
|
|
354
|
+
* @returns {*}
|
|
355
|
+
*/
|
|
356
|
+
radiansToDegrees(e) {
|
|
357
|
+
return e * this.RAD2DEG;
|
|
358
|
+
},
|
|
359
|
+
/**
|
|
360
|
+
* 弧度转角度
|
|
361
|
+
*
|
|
362
|
+
* @param {*} radians
|
|
363
|
+
* @returns {*}
|
|
364
|
+
*/
|
|
365
|
+
toDegrees(e) {
|
|
366
|
+
return e * this.RAD2DEG;
|
|
367
|
+
},
|
|
368
|
+
formatFloat(e, t = 2) {
|
|
369
|
+
return Math.round(e * Math.pow(10, t)) / Math.pow(10, t);
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
class et {
|
|
373
|
+
constructor(t) {
|
|
374
|
+
E.getDataType(t) === "String" && (t = document.querySelector("#" + t)), this.ctx = t.getContext("2d");
|
|
375
|
+
}
|
|
376
|
+
drawLine(t, n, s, i, r = {}) {
|
|
377
|
+
this.cxt.beginPath();
|
|
378
|
+
const a = r.width || 1, o = r.color || "#000";
|
|
379
|
+
this.cxt.lineWidth = a, this.cxt.fillStyle = o, this.cxt.moveTo(t, n), this.cxt.lineTo(s, i), this.cxt.closePath(), this.cxt.fill();
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* 绘制圆弧
|
|
383
|
+
* @param {*} x 圆心X坐标
|
|
384
|
+
* @param {*} y 圆心Y坐标
|
|
385
|
+
* @param {*} radius 半径
|
|
386
|
+
* @param {*} startAngle 开始的弧度
|
|
387
|
+
* @param {*} endAngle 结束的弧度
|
|
388
|
+
* @param {*} anticlockwise true为逆时针,false为顺时针
|
|
389
|
+
* @param {boolean} isOnlyArc
|
|
390
|
+
* @param {boolean} isFill 是否是填充,false为绘制边框,true为绘制填充
|
|
391
|
+
* @param {*} bgColor 圆弧的颜色
|
|
392
|
+
* @memberof CanvasDrawer
|
|
393
|
+
*/
|
|
394
|
+
drawArc(t, n, s, i, r, a, o, c) {
|
|
395
|
+
o ? (this.cxt.fillStyle = c, this.cxt.beginPath(), this.cxt.arc(t, n, s, g.degreesToRadians(i), g.degreesToRadians(r), a), this.cxt.closePath(), this.cxt.fill()) : (this.cxt.strokeStyle = c, this.cxt.beginPath(), this.cxt.arc(t, n, s, g.degreesToRadians(i), g.degreesToRadians(r), a), this.cxt.stroke());
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
class nt {
|
|
399
|
+
constructor(t = 1) {
|
|
400
|
+
this.magnification = t;
|
|
401
|
+
}
|
|
402
|
+
// 获取系统类型
|
|
403
|
+
_getSystem() {
|
|
404
|
+
var t = navigator.userAgent.toLowerCase();
|
|
405
|
+
if (t.indexOf("windows") >= 0)
|
|
406
|
+
return !0;
|
|
407
|
+
}
|
|
408
|
+
// 获取页面缩放比例
|
|
409
|
+
// _getDevicePixelRatio() {
|
|
410
|
+
// let t = this;
|
|
411
|
+
// }
|
|
412
|
+
// 监听方法兼容写法
|
|
413
|
+
_addHandler(t, n, s) {
|
|
414
|
+
t.addEventListener ? t.addEventListener(n, s, !1) : t.attachEvent ? t.attachEvent("on" + n, s) : t["on" + n] = s;
|
|
415
|
+
}
|
|
416
|
+
// 校正浏览器缩放比例
|
|
417
|
+
_correct() {
|
|
418
|
+
let t = window.innerWidth;
|
|
419
|
+
if (typeof t != "number" && (document.compatMode == "CSS1Compat" ? t = document.documentElement.clientWidth : t = document.body.clientWidth), t <= 750) {
|
|
420
|
+
const s = document.documentElement.clientWidth / t;
|
|
421
|
+
document.documentElement.style.fontSize = this.magnification * 75 * Math.min(s, 2) + "px";
|
|
422
|
+
} else if (t > 750 && t <= 1200) {
|
|
423
|
+
const s = document.documentElement.clientWidth / t;
|
|
424
|
+
document.documentElement.style.fontSize = this.magnification * 85 * Math.min(s, 2) + "px";
|
|
425
|
+
} else {
|
|
426
|
+
const s = document.documentElement.clientWidth / 1920;
|
|
427
|
+
document.documentElement.style.fontSize = this.magnification * 100 * Math.min(s, 2) + "px";
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
// 监听页面缩放
|
|
431
|
+
_watch() {
|
|
432
|
+
let t = this;
|
|
433
|
+
t._addHandler(window, "resize", function() {
|
|
434
|
+
t._correct();
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
// 初始化页面比例
|
|
438
|
+
init() {
|
|
439
|
+
let t = this;
|
|
440
|
+
t._getSystem() && (t._correct(), t._watch());
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
class q {
|
|
444
|
+
constructor() {
|
|
445
|
+
f(this, "_listeners");
|
|
446
|
+
f(this, "_mutex", {});
|
|
447
|
+
f(this, "_context");
|
|
448
|
+
}
|
|
449
|
+
addEventListener(t, n, s, i = !1) {
|
|
450
|
+
this._listeners === void 0 && (this._listeners = {}), this._context = s;
|
|
451
|
+
const r = this._mutex, a = this._listeners;
|
|
452
|
+
return a[t] === void 0 && (a[t] = []), a[t].indexOf(n) === -1 && (i && (r[t] = n), a[t].push(n)), this;
|
|
453
|
+
}
|
|
454
|
+
hasEventListener(t, n) {
|
|
455
|
+
if (this._listeners === null || this._listeners === void 0) return !1;
|
|
456
|
+
const s = this._listeners;
|
|
457
|
+
return s[t] !== void 0 && s[t].indexOf(n) !== -1;
|
|
458
|
+
}
|
|
459
|
+
removeEventListener(t, n) {
|
|
460
|
+
if (this._listeners === void 0) return;
|
|
461
|
+
const i = this._listeners[t];
|
|
462
|
+
if (this._mutex[t] === n && (this._mutex[t] = null), i !== void 0) {
|
|
463
|
+
const r = i.map((a) => a.toString()).indexOf(n.toString());
|
|
464
|
+
r !== -1 && i.splice(r, 1);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
dispatchEvent(t) {
|
|
468
|
+
if (this._listeners === void 0) return;
|
|
469
|
+
const s = this._listeners[t.type];
|
|
470
|
+
if (s !== void 0) {
|
|
471
|
+
t.target = this;
|
|
472
|
+
const i = s.slice(0);
|
|
473
|
+
if (this._mutex[t.type] !== void 0) {
|
|
474
|
+
const r = i.find((a) => a === this._mutex[t.type]);
|
|
475
|
+
if (r) {
|
|
476
|
+
r.call(this._context || this, t);
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
for (let r = 0, a = i.length; r < a; r++) {
|
|
481
|
+
const o = i[r];
|
|
482
|
+
typeof o == "function" && o.call(this._context || this, t);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
removeAllListener() {
|
|
487
|
+
this._mutex = {};
|
|
488
|
+
for (const t in this._listeners)
|
|
489
|
+
this._listeners[t] = [];
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
class U extends Map {
|
|
493
|
+
isEmpty() {
|
|
494
|
+
return this.size === 0;
|
|
495
|
+
}
|
|
496
|
+
_values() {
|
|
497
|
+
return Array.from(this.values());
|
|
498
|
+
}
|
|
499
|
+
_keys() {
|
|
500
|
+
return Array.from(this.keys());
|
|
501
|
+
}
|
|
502
|
+
_entries() {
|
|
503
|
+
return Array.from(this.entries());
|
|
504
|
+
}
|
|
505
|
+
fromEntries() {
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
U.prototype.fromEntries = function(e = []) {
|
|
509
|
+
const t = new U();
|
|
510
|
+
return e.forEach((n) => {
|
|
511
|
+
Array.isArray(n) && n.length === 2 && t.set(n[0], n[1]);
|
|
512
|
+
}), t;
|
|
513
|
+
};
|
|
514
|
+
class st extends q {
|
|
515
|
+
constructor(n = "ws://127.0.0.1:10088") {
|
|
516
|
+
super();
|
|
517
|
+
f(this, "maxCheckTimes", 10);
|
|
518
|
+
f(this, "url");
|
|
519
|
+
f(this, "checkTimes", 0);
|
|
520
|
+
f(this, "connectStatus", !1);
|
|
521
|
+
f(this, "client", null);
|
|
522
|
+
this.maxCheckTimes = 10, this.url = n, this.checkTimes = 0, this.connect(), this.connCheckStatus(this.maxCheckTimes);
|
|
523
|
+
}
|
|
524
|
+
connect() {
|
|
525
|
+
if (this.disconnect(), this.url)
|
|
526
|
+
try {
|
|
527
|
+
if (console.info("创建ws连接>>>" + this.url), this.client = new WebSocket(this.url), this.client) {
|
|
528
|
+
const n = this;
|
|
529
|
+
this.client.onopen = function(s) {
|
|
530
|
+
n.dispatchEvent({
|
|
531
|
+
type: b.WEB_SOCKET_CONNECT,
|
|
532
|
+
message: s
|
|
533
|
+
});
|
|
534
|
+
}, this.client.onmessage = function(s) {
|
|
535
|
+
n.connectStatus = !0, n.dispatchEvent({
|
|
536
|
+
type: b.WEB_SOCKET_MESSAGE,
|
|
537
|
+
message: s
|
|
538
|
+
});
|
|
539
|
+
}, this.client.onclose = function(s) {
|
|
540
|
+
n.dispatchEvent({
|
|
541
|
+
type: b.WEB_SOCKET_CLOSE,
|
|
542
|
+
message: s
|
|
543
|
+
});
|
|
544
|
+
}, this.checkTimes === this.maxCheckTimes && (this.client.onerror = function(s) {
|
|
545
|
+
n.dispatchEvent({
|
|
546
|
+
type: b.WEB_SOCKET_ERROR,
|
|
547
|
+
message: s
|
|
548
|
+
});
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
} catch (n) {
|
|
552
|
+
console.error("创建ws连接失败" + this.url + ":" + n);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
disconnect() {
|
|
556
|
+
if (this.client)
|
|
557
|
+
try {
|
|
558
|
+
console.log("ws断开连接" + this.url), this.client.close(), this.client = null;
|
|
559
|
+
} catch {
|
|
560
|
+
this.client = null;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
connCheckStatus(n) {
|
|
564
|
+
this.checkTimes > n || setTimeout(() => {
|
|
565
|
+
this.checkTimes++, this.client && this.client.readyState !== 0 && this.client.readyState !== 1 && this.connect(), this.connCheckStatus(n);
|
|
566
|
+
}, 2e3);
|
|
567
|
+
}
|
|
568
|
+
send(n) {
|
|
569
|
+
return this.client && this.client.readyState === 1 ? (this.client.send(n), !0) : (console.error(this.url + "消息发送失败:" + n), !1);
|
|
570
|
+
}
|
|
571
|
+
heartbeat() {
|
|
572
|
+
setTimeout(() => {
|
|
573
|
+
this.client && this.client.readyState === 1 && this.send("HeartBeat"), console.log("HeartBeat," + this.url), setTimeout(this.heartbeat, 3e4);
|
|
574
|
+
}, 1e3);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
class rt {
|
|
578
|
+
constructor(t = 1) {
|
|
579
|
+
f(this, "cacheType");
|
|
580
|
+
f(this, "storage");
|
|
581
|
+
if (this.cacheType = t, t === 1)
|
|
582
|
+
this.storage = window.localStorage;
|
|
583
|
+
else if (t === 2)
|
|
584
|
+
this.storage = window.sessionStorage;
|
|
585
|
+
else
|
|
586
|
+
throw new Error(p.PARAMETER_ERROR);
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* 设置带过期时间的LocalStorage
|
|
590
|
+
* @param key 缓存关键字
|
|
591
|
+
* @param value 缓存对象,可以是任意类型
|
|
592
|
+
* @param expired 以秒为单位,默认为1小时
|
|
593
|
+
* @returns {Object}
|
|
594
|
+
*/
|
|
595
|
+
setItem(t, n, s) {
|
|
596
|
+
const i = { key: t, value: n };
|
|
597
|
+
if (this.cacheType === 1) {
|
|
598
|
+
const r = Date.now();
|
|
599
|
+
s && (i.expired = r + s * 1e3);
|
|
600
|
+
}
|
|
601
|
+
return this.storage[t] = JSON.stringify(i), i;
|
|
602
|
+
}
|
|
603
|
+
/***
|
|
604
|
+
* 获取带过期时间的缓存
|
|
605
|
+
* @param key
|
|
606
|
+
* @returns {null|*}
|
|
607
|
+
*/
|
|
608
|
+
getItem(t) {
|
|
609
|
+
const n = this.storage.getItem(t);
|
|
610
|
+
if (n === null)
|
|
611
|
+
return null;
|
|
612
|
+
const s = JSON.parse(n) || {};
|
|
613
|
+
if (this.cacheType === 1) {
|
|
614
|
+
const i = s.expired ? new Date(s.expired).getTime() : Date.now();
|
|
615
|
+
if (Date.now() > i)
|
|
616
|
+
return this.remove(t), null;
|
|
617
|
+
}
|
|
618
|
+
return s.value;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* 移除指定缓存
|
|
622
|
+
* @param keys
|
|
623
|
+
*/
|
|
624
|
+
remove(t) {
|
|
625
|
+
t && (t.indexOf(",") > -1 ? t.split(",").forEach((n) => {
|
|
626
|
+
this.storage.removeItem(n);
|
|
627
|
+
}) : this.storage.removeItem(t));
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* 移出全部缓存
|
|
631
|
+
*/
|
|
632
|
+
clear() {
|
|
633
|
+
this.storage.clear();
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
const it = {
|
|
637
|
+
/**
|
|
638
|
+
* 多属性的动画函数
|
|
639
|
+
* @param {*} ele 需要运动的节点
|
|
640
|
+
* @param {*} attr_options 传入的是一个需要运动的属性包括运动的目标值,操作的节点属性
|
|
641
|
+
* @param {*} timefn 运动的形式,默认是缓冲运动
|
|
642
|
+
* @param {*} speed 运动的速度
|
|
643
|
+
*/
|
|
644
|
+
animate(e, t, n, s = "swing", i = 5) {
|
|
645
|
+
for (var r in t)
|
|
646
|
+
t[r] = {
|
|
647
|
+
target: r === "opacity" ? parseInt(t[r] * 100) : t[r],
|
|
648
|
+
// 需要计算得到
|
|
649
|
+
iNow: parseInt(r === "opacity" ? getComputedStyle(e)[r] * 100 : getComputedStyle(e)[r])
|
|
650
|
+
};
|
|
651
|
+
s === "liner" && (i = t[r].iNow < t[r].target ? Math.abs(i) : -Math.abs(i)), clearInterval(e.timer), e.timer = setInterval(function() {
|
|
652
|
+
for (var a in t) {
|
|
653
|
+
var o = t[a].target, c = t[a].iNow;
|
|
654
|
+
if (s === "swing" && (i = (o - c) / 20, i = i > 0 ? Math.ceil(i) : Math.floor(i)), Math.abs(o - c) <= Math.abs(i)) {
|
|
655
|
+
a === "opacity" ? e.style[a] = o / 100 : e.style[a] = o + "px", delete t[a];
|
|
656
|
+
for (var l in t)
|
|
657
|
+
return !1;
|
|
658
|
+
clearInterval(e.timer), typeof n == "function" && n();
|
|
659
|
+
} else
|
|
660
|
+
t[a].iNow += i, a === "opacity" ? e.style[a] = t[a].iNow / 100 : e.style[a] = t[a].iNow + "px";
|
|
661
|
+
}
|
|
662
|
+
}, 30);
|
|
663
|
+
}
|
|
325
664
|
};
|
|
326
665
|
Array.prototype.groupBy = function(e) {
|
|
327
666
|
var t = {};
|
|
@@ -333,8 +672,8 @@ Array.prototype.groupBy = function(e) {
|
|
|
333
672
|
Array.prototype.distinct = function(e = (t) => t) {
|
|
334
673
|
const t = [], n = {};
|
|
335
674
|
return this.forEach((s) => {
|
|
336
|
-
const
|
|
337
|
-
|
|
675
|
+
const i = e(s), r = String(i);
|
|
676
|
+
n[r] || (n[r] = !0, t.push(s));
|
|
338
677
|
}), t;
|
|
339
678
|
};
|
|
340
679
|
Array.prototype.max = function() {
|
|
@@ -358,7 +697,7 @@ Array.prototype.asc = function(e = (t) => t) {
|
|
|
358
697
|
Array.prototype.clear = function() {
|
|
359
698
|
return this.length = 0, this;
|
|
360
699
|
};
|
|
361
|
-
const
|
|
700
|
+
const at = {
|
|
362
701
|
asArray(e) {
|
|
363
702
|
return E.isEmpty(e) ? [] : Array.isArray(e) ? e : [e];
|
|
364
703
|
},
|
|
@@ -383,10 +722,17 @@ const et = {
|
|
|
383
722
|
difference(...e) {
|
|
384
723
|
return this.union(...e).filter((t) => !this.intersection(...e).includes(t));
|
|
385
724
|
}
|
|
386
|
-
},
|
|
725
|
+
}, ot = {
|
|
726
|
+
/**
|
|
727
|
+
* 从 URL 中解析出查询参数和哈希参数,并以对象的形式返回
|
|
728
|
+
*
|
|
729
|
+
* @param href 需要解析的 URL 链接,默认为当前窗口的 URL
|
|
730
|
+
* @param needDecode 是否需要解码参数值,默认为 true
|
|
731
|
+
* @returns 返回一个包含解析后参数的对象,其中键为参数名,值为参数值
|
|
732
|
+
*/
|
|
387
733
|
getUrlParams(e = window.location.href, t = !0) {
|
|
388
|
-
const n = /([^&=]+)=([\w\W]*?)(&|$|#)/g, { search: s, hash:
|
|
389
|
-
let
|
|
734
|
+
const n = /([^&=]+)=([\w\W]*?)(&|$|#)/g, { search: s, hash: i } = new URL(e), r = [s, i];
|
|
735
|
+
let a = {};
|
|
390
736
|
for (let o = 0; o < r.length; o++) {
|
|
391
737
|
const c = r[o];
|
|
392
738
|
if (c) {
|
|
@@ -395,53 +741,65 @@ const et = {
|
|
|
395
741
|
for (let u = 1; u < h.length; u++) {
|
|
396
742
|
let d;
|
|
397
743
|
for (; d = n.exec(h[u]); )
|
|
398
|
-
|
|
744
|
+
a[d[1]] = t ? decodeURIComponent(d[2]) : d[2];
|
|
399
745
|
}
|
|
400
746
|
}
|
|
401
747
|
}
|
|
402
|
-
return
|
|
748
|
+
return a;
|
|
403
749
|
},
|
|
750
|
+
/**
|
|
751
|
+
* 获取浏览器类型
|
|
752
|
+
*
|
|
753
|
+
* @returns 返回浏览器类型字符串,可能的值为 'IE'、'Firefox'、'Chrome'、'Opera'、'Safari' 或 'Unknown'
|
|
754
|
+
*/
|
|
404
755
|
getExplorer() {
|
|
405
756
|
var e = window.navigator.userAgent;
|
|
406
|
-
|
|
407
|
-
return "IE";
|
|
408
|
-
if (e.indexOf("Firefox") >= 0)
|
|
409
|
-
return "Firefox";
|
|
410
|
-
if (e.indexOf("Chrome") >= 0)
|
|
411
|
-
return "Chrome";
|
|
412
|
-
if (e.indexOf("Opera") >= 0)
|
|
413
|
-
return "Opera";
|
|
414
|
-
if (e.indexOf("Safari") >= 0)
|
|
415
|
-
return "Safari";
|
|
757
|
+
return e.indexOf("MSIE") >= 0 || /Trident\//.test(e) ? "IE" : e.indexOf("Firefox") >= 0 ? "Firefox" : e.indexOf("Chrome") >= 0 ? "Chrome" : e.indexOf("Opera") >= 0 ? "Opera" : e.indexOf("Safari") >= 0 && e.indexOf("Chrome") === -1 ? "Safari" : "Unknown";
|
|
416
758
|
},
|
|
759
|
+
/**
|
|
760
|
+
* 检测操作系统类型
|
|
761
|
+
*
|
|
762
|
+
* @returns 返回操作系统类型字符串,可能的值有:'MS Windows'、'Apple mac'、'Linux'、'Unix'
|
|
763
|
+
*/
|
|
417
764
|
detectOS() {
|
|
418
765
|
let e = "";
|
|
419
|
-
const t = navigator.userAgent.indexOf("Windows", 0) != -1 ? 1 : 0, n = navigator.userAgent.indexOf("mac", 0) != -1 ? 1 : 0, s = navigator.userAgent.indexOf("Linux", 0) != -1 ? 1 : 0,
|
|
420
|
-
return t ? e = "MS Windows" : n ? e = "Apple mac" : s ? e = "Linux" :
|
|
766
|
+
const t = navigator.userAgent.indexOf("Windows", 0) != -1 ? 1 : 0, n = navigator.userAgent.indexOf("mac", 0) != -1 ? 1 : 0, s = navigator.userAgent.indexOf("Linux", 0) != -1 ? 1 : 0, i = navigator.userAgent.indexOf("X11", 0) != -1 ? 1 : 0;
|
|
767
|
+
return t ? e = "MS Windows" : n ? e = "Apple mac" : s ? e = "Linux" : i && (e = "Unix"), e;
|
|
421
768
|
},
|
|
769
|
+
/**
|
|
770
|
+
* 切换全屏状态
|
|
771
|
+
*
|
|
772
|
+
* @param status 是否全屏
|
|
773
|
+
*/
|
|
422
774
|
switchFullScreen(e) {
|
|
423
775
|
if (e) {
|
|
424
776
|
const t = document.documentElement;
|
|
425
|
-
t.requestFullscreen ? t.requestFullscreen() :
|
|
777
|
+
t.requestFullscreen ? t.requestFullscreen() : "msRequestFullscreen" in t ? t.msRequestFullscreen() : "mozRequestFullScreen" in t ? t.mozRequestFullScreen() : "webkitRequestFullscreen" in t && t.webkitRequestFullscreen();
|
|
426
778
|
} else
|
|
427
|
-
document.exitFullscreen ? document.exitFullscreen() :
|
|
779
|
+
document.exitFullscreen ? document.exitFullscreen() : "msExitFullscreen" in document ? document.msExitFullscreen() : "mozCancelFullScreen" in document ? document.mozCancelFullScreen() : "webkitExitFullscreen" in document && document.webkitExitFullscreen();
|
|
428
780
|
},
|
|
429
781
|
/**
|
|
430
|
-
*
|
|
782
|
+
* 刷新缩放比例
|
|
783
|
+
*
|
|
784
|
+
* @returns 无返回值
|
|
431
785
|
*/
|
|
432
786
|
refreshScale() {
|
|
433
|
-
const e = document.documentElement.clientWidth, t = document.documentElement.clientHeight, n = document.getElementById("app")
|
|
434
|
-
|
|
435
|
-
s
|
|
787
|
+
const e = document.documentElement.clientWidth || 0, t = document.documentElement.clientHeight || 0, n = document.getElementById("app");
|
|
788
|
+
if (!n) return;
|
|
789
|
+
const s = n.style, i = e / t, r = 16 / 9;
|
|
790
|
+
let a = e / 1920;
|
|
791
|
+
i > r && (a = t / 1080), s.transformOrigin = "left top", s.transform = `scale(${a}) translateX(-49.99%)`, s.width = `${e / a}px`;
|
|
436
792
|
},
|
|
437
793
|
/**
|
|
438
|
-
*
|
|
794
|
+
* 获取HTML字体大小
|
|
795
|
+
*
|
|
796
|
+
* @returns 无返回值,该函数会直接修改HTML元素的字体大小
|
|
439
797
|
*/
|
|
440
798
|
getHtmlFontSize() {
|
|
441
799
|
const e = document.documentElement.clientWidth || document.body.clientWidth, t = document.querySelector("html");
|
|
442
|
-
t.style.fontSize = e / 192 + "px";
|
|
800
|
+
t && (t.style.fontSize = e / 192 + "px");
|
|
443
801
|
}
|
|
444
|
-
},
|
|
802
|
+
}, ct = {
|
|
445
803
|
set: function(e, t, n = 30) {
|
|
446
804
|
var s = /* @__PURE__ */ new Date();
|
|
447
805
|
s.setTime(s.getTime() + n * 24 * 60 * 60 * 1e3), document.cookie = e + "=" + escape(t) + ";expires=" + s.toUTCString();
|
|
@@ -456,17 +814,17 @@ const et = {
|
|
|
456
814
|
var t = document.cookie.match(new RegExp("(^| )" + e + "=([^;]*)(;|$)"));
|
|
457
815
|
return t != null ? t[2] : "";
|
|
458
816
|
}
|
|
459
|
-
},
|
|
817
|
+
}, lt = {
|
|
460
818
|
PI: 3.141592653589793,
|
|
461
819
|
XPI: 3.141592653589793 * 3e3 / 180,
|
|
462
820
|
delta(e, t) {
|
|
463
821
|
const s = 0.006693421622965943;
|
|
464
|
-
let
|
|
465
|
-
const
|
|
466
|
-
let o = Math.sin(
|
|
822
|
+
let i = this.transformLat(t - 105, e - 35), r = this.transformLon(t - 105, e - 35);
|
|
823
|
+
const a = e / 180 * this.PI;
|
|
824
|
+
let o = Math.sin(a);
|
|
467
825
|
o = 1 - s * o * o;
|
|
468
826
|
const c = Math.sqrt(o);
|
|
469
|
-
return
|
|
827
|
+
return i = i * 180 / (6378245 * (1 - s) / (o * c) * this.PI), r = r * 180 / (6378245 / c * Math.cos(a) * this.PI), { lat: i, lng: r };
|
|
470
828
|
},
|
|
471
829
|
// WGS-84 to GCJ-02
|
|
472
830
|
gcjEncrypt(e, t) {
|
|
@@ -484,23 +842,23 @@ const et = {
|
|
|
484
842
|
},
|
|
485
843
|
// GCJ-02 to WGS-84 exactly
|
|
486
844
|
gcjDecryptExact(e, t) {
|
|
487
|
-
let
|
|
845
|
+
let i = 0.01, r = 0.01, a = e - i, o = t - r, c = e + i, l = t + r, h = 0, u = 0, d = 0;
|
|
488
846
|
for (; ; ) {
|
|
489
|
-
h = (
|
|
847
|
+
h = (a + c) / 2, u = (o + l) / 2;
|
|
490
848
|
const R = this.gcjEncrypt(h, u);
|
|
491
|
-
if (
|
|
849
|
+
if (i = R.lat - e, r = R.lng - t, Math.abs(i) < 1e-9 && Math.abs(r) < 1e-9 || (i > 0 ? c = h : a = h, r > 0 ? l = u : o = u, ++d > 1e4)) break;
|
|
492
850
|
}
|
|
493
851
|
return { lat: h, lng: u };
|
|
494
852
|
},
|
|
495
853
|
// GCJ-02 to BD-09
|
|
496
854
|
bdEncrypt(e, t) {
|
|
497
|
-
const n = t, s = e,
|
|
498
|
-
return { lat:
|
|
855
|
+
const n = t, s = e, i = Math.sqrt(n * n + s * s) + 2e-5 * Math.sin(s * this.XPI), r = Math.atan2(s, n) + 3e-6 * Math.cos(n * this.XPI), a = i * Math.cos(r) + 65e-4;
|
|
856
|
+
return { lat: i * Math.sin(r) + 6e-3, lng: a };
|
|
499
857
|
},
|
|
500
858
|
// BD-09 to GCJ-02
|
|
501
859
|
bdDecrypt(e, t) {
|
|
502
|
-
const n = t - 65e-4, s = e - 6e-3,
|
|
503
|
-
return { lat:
|
|
860
|
+
const n = t - 65e-4, s = e - 6e-3, i = Math.sqrt(n * n + s * s) - 2e-5 * Math.sin(s * this.XPI), r = Math.atan2(s, n) - 3e-6 * Math.cos(n * this.XPI), a = i * Math.cos(r);
|
|
861
|
+
return { lat: i * Math.sin(r), lng: a };
|
|
504
862
|
},
|
|
505
863
|
// WGS-84 to Web mercator
|
|
506
864
|
// mercatorLat -> y mercatorLon -> x
|
|
@@ -518,8 +876,8 @@ const et = {
|
|
|
518
876
|
},
|
|
519
877
|
// two point's distance
|
|
520
878
|
distance(e, t, n, s) {
|
|
521
|
-
const r = Math.cos(e * this.PI / 180) * Math.cos(n * this.PI / 180) * Math.cos((t - s) * this.PI / 180),
|
|
522
|
-
let o = r +
|
|
879
|
+
const r = Math.cos(e * this.PI / 180) * Math.cos(n * this.PI / 180) * Math.cos((t - s) * this.PI / 180), a = Math.sin(e * this.PI / 180) * Math.sin(n * this.PI / 180);
|
|
880
|
+
let o = r + a;
|
|
523
881
|
return o > 1 && (o = 1), o < -1 && (o = -1), Math.acos(o) * 6371e3;
|
|
524
882
|
},
|
|
525
883
|
outOfChina(e, t) {
|
|
@@ -600,7 +958,7 @@ Date.prototype.addDate = function(e, t) {
|
|
|
600
958
|
}
|
|
601
959
|
return n;
|
|
602
960
|
};
|
|
603
|
-
const
|
|
961
|
+
const ht = {
|
|
604
962
|
lastMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - 1, 1),
|
|
605
963
|
thisMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1),
|
|
606
964
|
nextMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + 1, 1),
|
|
@@ -644,26 +1002,26 @@ const at = {
|
|
|
644
1002
|
* @returns {*}
|
|
645
1003
|
*/
|
|
646
1004
|
formatDateInterval(e, t) {
|
|
647
|
-
const n = new Date(e),
|
|
1005
|
+
const n = new Date(e), i = new Date(t).getTime() - n.getTime(), r = Math.floor(i / (24 * 3600 * 1e3)), a = i % (24 * 3600 * 1e3), o = Math.floor(a / (3600 * 1e3)), c = a % (3600 * 1e3), l = Math.floor(c / (60 * 1e3)), h = c % (60 * 1e3), u = Math.round(h / 1e3);
|
|
648
1006
|
let d = "";
|
|
649
1007
|
return r > 0 && (d += r + "天"), o > 0 && (d += o + "时"), l > 0 && (d += l + "分"), u > 0 && (d += u + "秒"), r === 0 && o === 0 && l === 0 && u === 0 && (d = "少于1秒"), d;
|
|
650
1008
|
},
|
|
651
1009
|
formatterCounter(e) {
|
|
652
1010
|
const t = function(o) {
|
|
653
1011
|
return (o > 10 ? "" : "0") + (o || 0);
|
|
654
|
-
}, n = t(Math.floor(e / 3600)), s = e % 3600,
|
|
655
|
-
return `${n}:${
|
|
1012
|
+
}, n = t(Math.floor(e / 3600)), s = e % 3600, i = t(Math.floor(s / 60)), r = s % 60, a = t(Math.round(r));
|
|
1013
|
+
return `${n}:${i}:${a}`;
|
|
656
1014
|
},
|
|
657
1015
|
sleep(e) {
|
|
658
1016
|
}
|
|
659
1017
|
};
|
|
660
|
-
function
|
|
1018
|
+
function Y(e) {
|
|
661
1019
|
return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "");
|
|
662
1020
|
}
|
|
663
|
-
function
|
|
664
|
-
return
|
|
1021
|
+
function F(e) {
|
|
1022
|
+
return Y(e).split(/\s+/);
|
|
665
1023
|
}
|
|
666
|
-
const
|
|
1024
|
+
const ut = {
|
|
667
1025
|
/**
|
|
668
1026
|
* 获取元素的样式值
|
|
669
1027
|
*
|
|
@@ -675,8 +1033,8 @@ const it = {
|
|
|
675
1033
|
var s;
|
|
676
1034
|
let n = e.style[t];
|
|
677
1035
|
if (!n || n === "auto") {
|
|
678
|
-
const
|
|
679
|
-
n =
|
|
1036
|
+
const i = (s = document.defaultView) == null ? void 0 : s.getComputedStyle(e, null);
|
|
1037
|
+
n = i ? i[t] : null, n === "auto" && (n = null);
|
|
680
1038
|
}
|
|
681
1039
|
return n;
|
|
682
1040
|
},
|
|
@@ -762,8 +1120,8 @@ const it = {
|
|
|
762
1120
|
*/
|
|
763
1121
|
addClass(e, t) {
|
|
764
1122
|
if (e.classList !== void 0) {
|
|
765
|
-
const n =
|
|
766
|
-
for (let s = 0,
|
|
1123
|
+
const n = F(t);
|
|
1124
|
+
for (let s = 0, i = n.length; s < i; s++)
|
|
767
1125
|
e.classList.add(n[s]);
|
|
768
1126
|
} else if (!this.hasClass(e, t)) {
|
|
769
1127
|
const n = this.getClass(e);
|
|
@@ -777,7 +1135,7 @@ const it = {
|
|
|
777
1135
|
* @param name 要移除的类名,多个类名用空格分隔
|
|
778
1136
|
*/
|
|
779
1137
|
removeClass(e, t) {
|
|
780
|
-
e.classList !== void 0 ?
|
|
1138
|
+
e.classList !== void 0 ? F(t).forEach((s) => e.classList.remove(s)) : this.setClass(e, (" " + this.getClass(e) + " ").replace(" " + t + " ", " ").trim());
|
|
781
1139
|
},
|
|
782
1140
|
/**
|
|
783
1141
|
* 设置元素的 CSS 类名
|
|
@@ -797,55 +1155,7 @@ const it = {
|
|
|
797
1155
|
parseFromString(e) {
|
|
798
1156
|
return new DOMParser().parseFromString(e, "text/xml").children[0];
|
|
799
1157
|
}
|
|
800
|
-
},
|
|
801
|
-
DEG2RAD: Math.PI / 180,
|
|
802
|
-
RAD2DEG: 180 / Math.PI,
|
|
803
|
-
randInt(e, t) {
|
|
804
|
-
return e + Math.floor(Math.random() * (t - e + 1));
|
|
805
|
-
},
|
|
806
|
-
randFloat(e, t) {
|
|
807
|
-
return e + Math.random() * (t - e);
|
|
808
|
-
},
|
|
809
|
-
/**
|
|
810
|
-
* 角度转弧度
|
|
811
|
-
*
|
|
812
|
-
* @param {*} degrees
|
|
813
|
-
* @returns {*}
|
|
814
|
-
*/
|
|
815
|
-
degreesToRadians(e) {
|
|
816
|
-
return e * this.DEG2RAD;
|
|
817
|
-
},
|
|
818
|
-
/**
|
|
819
|
-
* 角度转弧度
|
|
820
|
-
*
|
|
821
|
-
* @param {*} degrees
|
|
822
|
-
* @returns {*}
|
|
823
|
-
*/
|
|
824
|
-
toRadians(e) {
|
|
825
|
-
return e * this.DEG2RAD;
|
|
826
|
-
},
|
|
827
|
-
/**
|
|
828
|
-
* 弧度转角度
|
|
829
|
-
*
|
|
830
|
-
* @param {*} radians
|
|
831
|
-
* @returns {*}
|
|
832
|
-
*/
|
|
833
|
-
radiansToDegrees(e) {
|
|
834
|
-
return e * this.RAD2DEG;
|
|
835
|
-
},
|
|
836
|
-
/**
|
|
837
|
-
* 弧度转角度
|
|
838
|
-
*
|
|
839
|
-
* @param {*} radians
|
|
840
|
-
* @returns {*}
|
|
841
|
-
*/
|
|
842
|
-
toDegrees(e) {
|
|
843
|
-
return e * this.RAD2DEG;
|
|
844
|
-
},
|
|
845
|
-
formatFloat(e, t = 2) {
|
|
846
|
-
return Math.round(e * Math.pow(10, t)) / Math.pow(10, t);
|
|
847
|
-
}
|
|
848
|
-
}, q = {
|
|
1158
|
+
}, j = {
|
|
849
1159
|
toRadian: Math.PI / 180,
|
|
850
1160
|
R: 6371393,
|
|
851
1161
|
/**
|
|
@@ -867,9 +1177,9 @@ const it = {
|
|
|
867
1177
|
*/
|
|
868
1178
|
formatLnglat(e, t) {
|
|
869
1179
|
let n = "";
|
|
870
|
-
function s(
|
|
871
|
-
const r = Math.floor(
|
|
872
|
-
return `${r}°${
|
|
1180
|
+
function s(i) {
|
|
1181
|
+
const r = Math.floor(i), a = Math.floor((i - r) * 60), o = (i - r) * 3600 - a * 60;
|
|
1182
|
+
return `${r}°${a}′${o.toFixed(2)}″`;
|
|
873
1183
|
}
|
|
874
1184
|
return this.isLnglat(e, t) ? n = s(e) + "," + s(t) : isNaN(e) ? isNaN(t) || (n = s(t)) : n = s(e), n;
|
|
875
1185
|
},
|
|
@@ -883,10 +1193,10 @@ const it = {
|
|
|
883
1193
|
transformLnglat(e, t) {
|
|
884
1194
|
function n(s) {
|
|
885
1195
|
let r = /[sw]/i.test(s) ? -1 : 1;
|
|
886
|
-
const
|
|
1196
|
+
const a = s.match(/[\d.]+/g) || [];
|
|
887
1197
|
let o = 0;
|
|
888
|
-
for (let c = 0; c <
|
|
889
|
-
o += parseFloat(
|
|
1198
|
+
for (let c = 0; c < a.length; c++)
|
|
1199
|
+
o += parseFloat(a[c]) / r, r *= 60;
|
|
890
1200
|
return o;
|
|
891
1201
|
}
|
|
892
1202
|
if (e && t)
|
|
@@ -903,7 +1213,7 @@ const it = {
|
|
|
903
1213
|
* @returns 返回字符串,表示点相对于多边形的位置:'in'表示在多边形内,'out'表示在多边形外,'on'表示在多边形上
|
|
904
1214
|
*/
|
|
905
1215
|
rayCasting(e, t) {
|
|
906
|
-
for (var n = e.x, s = e.y,
|
|
1216
|
+
for (var n = e.x, s = e.y, i = !1, r = 0, a = t.length, o = a - 1; r < a; o = r, r++) {
|
|
907
1217
|
var c = t[r].x, l = t[r].y, h = t[o].x, u = t[o].y;
|
|
908
1218
|
if (c === n && l === s || h === n && u === s)
|
|
909
1219
|
return "on";
|
|
@@ -911,10 +1221,10 @@ const it = {
|
|
|
911
1221
|
var d = c + (s - l) * (h - c) / (u - l);
|
|
912
1222
|
if (d === n)
|
|
913
1223
|
return "on";
|
|
914
|
-
d > n && (
|
|
1224
|
+
d > n && (i = !i);
|
|
915
1225
|
}
|
|
916
1226
|
}
|
|
917
|
-
return
|
|
1227
|
+
return i ? "in" : "out";
|
|
918
1228
|
},
|
|
919
1229
|
/**
|
|
920
1230
|
* 计算两个WGS-84坐标点之间的距离
|
|
@@ -930,21 +1240,21 @@ const it = {
|
|
|
930
1240
|
}
|
|
931
1241
|
if (arguments.length != 2)
|
|
932
1242
|
return 0;
|
|
933
|
-
const
|
|
934
|
-
var c = 6378137, l = 63567523142e-4, h = 1 / 298.257223563, u = s(
|
|
1243
|
+
const i = e.x, r = e.y, a = t.x, o = t.y;
|
|
1244
|
+
var c = 6378137, l = 63567523142e-4, h = 1 / 298.257223563, u = s(a - i), d = Math.atan((1 - h) * Math.tan(s(r))), R = Math.atan((1 - h) * Math.tan(s(o))), O = Math.sin(d), v = Math.cos(d), A = Math.sin(R), w = Math.cos(R), D = u, L, N = 100;
|
|
935
1245
|
do {
|
|
936
|
-
var
|
|
937
|
-
w *
|
|
1246
|
+
var T = Math.sin(D), I = Math.cos(D), y = Math.sqrt(
|
|
1247
|
+
w * T * (w * T) + (v * A - O * w * I) * (v * A - O * w * I)
|
|
938
1248
|
);
|
|
939
1249
|
if (y == 0) return 0;
|
|
940
|
-
var S = O * A + v * w *
|
|
1250
|
+
var S = O * A + v * w * I, k = Math.atan2(y, S), C = v * w * T / y, x = 1 - C * C, m = S - 2 * O * A / x;
|
|
941
1251
|
isNaN(m) && (m = 0);
|
|
942
|
-
var _ = h / 16 *
|
|
1252
|
+
var _ = h / 16 * x * (4 + h * (4 - 3 * x));
|
|
943
1253
|
L = D, D = u + (1 - _) * h * C * (k + _ * y * (m + _ * S * (-1 + 2 * m * m)));
|
|
944
1254
|
} while (Math.abs(D - L) > 1e-12 && --N > 0);
|
|
945
1255
|
if (N == 0)
|
|
946
1256
|
return NaN;
|
|
947
|
-
var M =
|
|
1257
|
+
var M = x * (c * c - l * l) / (l * l), $ = 1 + M / 16384 * (4096 + M * (-768 + M * (320 - 175 * M))), P = M / 1024 * (256 + M * (-128 + M * (74 - 47 * M))), B = P * y * (m + P / 4 * (S * (-1 + 2 * m * m) - P / 6 * m * (-3 + 4 * y * y) * (-3 + 4 * m * m))), W = l * $ * (k - B);
|
|
948
1258
|
return W;
|
|
949
1259
|
},
|
|
950
1260
|
/**
|
|
@@ -956,8 +1266,8 @@ const it = {
|
|
|
956
1266
|
* @returns 旋转后点坐标
|
|
957
1267
|
*/
|
|
958
1268
|
rotatePoint(e, t, n) {
|
|
959
|
-
const s = (e.x - t.x) * Math.cos(Math.PI / 180 * -n) - (e.y - t.y) * Math.sin(Math.PI / 180 * -n) + t.x,
|
|
960
|
-
return { x: s, y:
|
|
1269
|
+
const s = (e.x - t.x) * Math.cos(Math.PI / 180 * -n) - (e.y - t.y) * Math.sin(Math.PI / 180 * -n) + t.x, i = (e.x - t.x) * Math.sin(Math.PI / 180 * -n) + (e.y - t.y) * Math.cos(Math.PI / 180 * -n) + t.y;
|
|
1270
|
+
return { x: s, y: i };
|
|
961
1271
|
},
|
|
962
1272
|
/**
|
|
963
1273
|
* 根据两个平面坐标点计算方位角和距离
|
|
@@ -967,8 +1277,8 @@ const it = {
|
|
|
967
1277
|
* @returns 返回一个对象,包含angle和distance属性,分别表示两点之间的角度(以度为单位,取值范围为0~359)和距离
|
|
968
1278
|
*/
|
|
969
1279
|
calcBearAndDis(e, t) {
|
|
970
|
-
const { x: n, y: s } = e, { x:
|
|
971
|
-
return { angle: (Math.atan2(o,
|
|
1280
|
+
const { x: n, y: s } = e, { x: i, y: r } = t, a = i - n, o = r - s, c = Math.sqrt(a * a + o * o);
|
|
1281
|
+
return { angle: (Math.atan2(o, a) * (180 / Math.PI) + 360 + 90) % 360, distance: c };
|
|
972
1282
|
},
|
|
973
1283
|
/**
|
|
974
1284
|
* 根据两个经纬度点计算方位角和距离
|
|
@@ -978,7 +1288,7 @@ const it = {
|
|
|
978
1288
|
* @returns 包含方位角和距离的对象
|
|
979
1289
|
*/
|
|
980
1290
|
calcBearAndDisByPoints(e, t) {
|
|
981
|
-
var n = e.lat * 1, s = e.lng * 1,
|
|
1291
|
+
var n = e.lat * 1, s = e.lng * 1, i = t.lat * 1, r = t.lng * 1, a = Math.sin((r - s) * this.toRadian) * Math.cos(i * this.toRadian), o = Math.cos(n * this.toRadian) * Math.sin(i * this.toRadian) - Math.sin(n * this.toRadian) * Math.cos(i * this.toRadian) * Math.cos((r - s) * this.toRadian), c = Math.atan2(a, o) * (180 / Math.PI), l = (i - n) * this.toRadian, h = (r - s) * this.toRadian, u = Math.sin(l / 2) * Math.sin(l / 2) + Math.cos(n * this.toRadian) * Math.cos(i * this.toRadian) * Math.sin(h / 2) * Math.sin(h / 2), d = 2 * Math.atan2(Math.sqrt(u), Math.sqrt(1 - u)), R = this.R * d;
|
|
982
1292
|
return {
|
|
983
1293
|
angle: c,
|
|
984
1294
|
distance: R
|
|
@@ -993,11 +1303,11 @@ const it = {
|
|
|
993
1303
|
* @returns 返回计算后的新经纬度点,类型为{lat: number, lng: number}
|
|
994
1304
|
*/
|
|
995
1305
|
calcPointByBearAndDis(e, t, n) {
|
|
996
|
-
const s = g.toRadians(e.lat * 1),
|
|
1306
|
+
const s = g.toRadians(e.lat * 1), i = g.toRadians(e.lng * 1), r = n / this.R;
|
|
997
1307
|
t = g.toRadians(t);
|
|
998
|
-
const
|
|
1308
|
+
const a = Math.asin(Math.sin(s) * Math.cos(r) + Math.cos(s) * Math.sin(r) * Math.cos(t)), o = i + Math.atan2(Math.sin(t) * Math.sin(r) * Math.cos(s), Math.cos(r) - Math.sin(s) * Math.sin(a));
|
|
999
1309
|
return {
|
|
1000
|
-
lat: g.toDegrees(
|
|
1310
|
+
lat: g.toDegrees(a),
|
|
1001
1311
|
lng: g.toDegrees(o)
|
|
1002
1312
|
};
|
|
1003
1313
|
},
|
|
@@ -1011,8 +1321,8 @@ const it = {
|
|
|
1011
1321
|
mercatorTolonlat(e, t) {
|
|
1012
1322
|
const n = e / 2003750834e-2 * 180;
|
|
1013
1323
|
var s = t / 2003750834e-2 * 180;
|
|
1014
|
-
const
|
|
1015
|
-
return { lng: n, lat:
|
|
1324
|
+
const i = 180 / Math.PI * (2 * Math.atan(Math.exp(s * Math.PI / 180)) - Math.PI / 2);
|
|
1325
|
+
return { lng: n, lat: i };
|
|
1016
1326
|
},
|
|
1017
1327
|
/**
|
|
1018
1328
|
* 将经纬度坐标转换为墨卡托坐标
|
|
@@ -1024,11 +1334,11 @@ const it = {
|
|
|
1024
1334
|
lonlatToMercator(e, t) {
|
|
1025
1335
|
var n = 6378137;
|
|
1026
1336
|
const s = e * Math.PI / 180 * n;
|
|
1027
|
-
var
|
|
1028
|
-
const r = n / 2 * Math.log((1 + Math.sin(
|
|
1337
|
+
var i = t * Math.PI / 180;
|
|
1338
|
+
const r = n / 2 * Math.log((1 + Math.sin(i)) / (1 - Math.sin(i)));
|
|
1029
1339
|
return { x: s, y: r };
|
|
1030
1340
|
}
|
|
1031
|
-
},
|
|
1341
|
+
}, dt = {
|
|
1032
1342
|
/**
|
|
1033
1343
|
* 将Base64编码的字符串转换为Blob对象
|
|
1034
1344
|
*
|
|
@@ -1037,10 +1347,10 @@ const it = {
|
|
|
1037
1347
|
*/
|
|
1038
1348
|
convertBase64ToBlob(e) {
|
|
1039
1349
|
const t = e.split(",")[0].split(":")[1].split(";")[0], n = atob(e.split(",")[1]), s = new Array(n.length);
|
|
1040
|
-
for (let
|
|
1041
|
-
s[
|
|
1042
|
-
const
|
|
1043
|
-
return new Blob([
|
|
1350
|
+
for (let a = 0; a < n.length; a++)
|
|
1351
|
+
s[a] = n.charCodeAt(a);
|
|
1352
|
+
const i = new Uint8Array(s);
|
|
1353
|
+
return new Blob([i], { type: t });
|
|
1044
1354
|
},
|
|
1045
1355
|
/**
|
|
1046
1356
|
* 将图片的URL转换为Base64编码
|
|
@@ -1051,24 +1361,24 @@ const it = {
|
|
|
1051
1361
|
* @returns 返回Promise对象,解析后得到包含Base64编码数据的对象
|
|
1052
1362
|
*/
|
|
1053
1363
|
convertUrlToBase64(e, t, n) {
|
|
1054
|
-
return new Promise((s,
|
|
1364
|
+
return new Promise((s, i) => {
|
|
1055
1365
|
var r = new Image();
|
|
1056
1366
|
r.crossOrigin = "Anonymous", r.src = e, r.onload = function() {
|
|
1057
|
-
var
|
|
1058
|
-
|
|
1059
|
-
var o =
|
|
1367
|
+
var a = document.createElement("canvas");
|
|
1368
|
+
a.width = t || r.width, a.height = n || r.height;
|
|
1369
|
+
var o = a.getContext("2d");
|
|
1060
1370
|
if (!o) {
|
|
1061
|
-
|
|
1371
|
+
i(new Error("Failed to get canvas context"));
|
|
1062
1372
|
return;
|
|
1063
1373
|
}
|
|
1064
1374
|
o.drawImage(r, 0, 0, r.width, r.height);
|
|
1065
|
-
var c = r.src.substring(r.src.lastIndexOf(".") + 1).toLowerCase(), l =
|
|
1375
|
+
var c = r.src.substring(r.src.lastIndexOf(".") + 1).toLowerCase(), l = a.toDataURL("image/" + c), h = {
|
|
1066
1376
|
dataURL: l,
|
|
1067
1377
|
type: "image/" + c,
|
|
1068
1378
|
ext: c
|
|
1069
1379
|
};
|
|
1070
1380
|
s(h);
|
|
1071
|
-
}, r.onerror =
|
|
1381
|
+
}, r.onerror = i;
|
|
1072
1382
|
});
|
|
1073
1383
|
},
|
|
1074
1384
|
/**
|
|
@@ -1079,10 +1389,10 @@ const it = {
|
|
|
1079
1389
|
* @returns 返回文件对象
|
|
1080
1390
|
*/
|
|
1081
1391
|
convertBase64ToFile(e, t) {
|
|
1082
|
-
const n = e.split(","), s = n[0].match(/:(.*?);/),
|
|
1392
|
+
const n = e.split(","), s = n[0].match(/:(.*?);/), i = s ? s[1] : "image/png", r = atob(n[1]), a = new Uint8Array(r.length);
|
|
1083
1393
|
for (let c = 0; c < r.length; c++)
|
|
1084
|
-
|
|
1085
|
-
return new File([
|
|
1394
|
+
a[c] = r.charCodeAt(c);
|
|
1395
|
+
return new File([a], t, { type: i });
|
|
1086
1396
|
},
|
|
1087
1397
|
/**
|
|
1088
1398
|
* 直接下载文件,支持blob类型和url类型
|
|
@@ -1095,8 +1405,8 @@ const it = {
|
|
|
1095
1405
|
if (e instanceof Blob)
|
|
1096
1406
|
e = URL.createObjectURL(e);
|
|
1097
1407
|
else {
|
|
1098
|
-
const s = JSON.stringify(e),
|
|
1099
|
-
e = window.URL.createObjectURL(
|
|
1408
|
+
const s = JSON.stringify(e), i = new Blob([s], { type: "text/json" });
|
|
1409
|
+
e = window.URL.createObjectURL(i);
|
|
1100
1410
|
}
|
|
1101
1411
|
else if (typeof e == "string" && e.indexOf("http") === -1) {
|
|
1102
1412
|
const s = new Blob([e], { type: "text/json" });
|
|
@@ -1105,7 +1415,7 @@ const it = {
|
|
|
1105
1415
|
var n = document.createElement("a");
|
|
1106
1416
|
n.href = e, n.download = t || "", n.click(), window.URL.revokeObjectURL(n.href);
|
|
1107
1417
|
}
|
|
1108
|
-
},
|
|
1418
|
+
}, ft = {
|
|
1109
1419
|
/**
|
|
1110
1420
|
* 防抖函数,在指定的等待时间内,如果连续触发事件,则只在最后一次触发后执行函数。
|
|
1111
1421
|
*
|
|
@@ -1115,26 +1425,26 @@ const it = {
|
|
|
1115
1425
|
* @returns 返回防抖后的函数。
|
|
1116
1426
|
*/
|
|
1117
1427
|
debounce(e, t, n = !0) {
|
|
1118
|
-
let s = null,
|
|
1428
|
+
let s = null, i, r, a, o;
|
|
1119
1429
|
const c = function() {
|
|
1120
|
-
const l = Date.now() -
|
|
1121
|
-
l < t && l > 0 ? s = setTimeout(c, t - l) : (s = null, n || (o = e.apply(r,
|
|
1430
|
+
const l = Date.now() - a;
|
|
1431
|
+
l < t && l > 0 ? s = setTimeout(c, t - l) : (s = null, n || (o = e.apply(r, i)));
|
|
1122
1432
|
};
|
|
1123
1433
|
return function(...l) {
|
|
1124
|
-
r = this,
|
|
1434
|
+
r = this, a = Date.now();
|
|
1125
1435
|
const h = n && !s;
|
|
1126
1436
|
return s || (s = setTimeout(c, t)), h && (o = e.apply(r, l), s || (r = l = null)), o;
|
|
1127
1437
|
};
|
|
1128
1438
|
},
|
|
1129
1439
|
throttle(e, t, n) {
|
|
1130
|
-
let s = 0,
|
|
1440
|
+
let s = 0, i = null;
|
|
1131
1441
|
return function(...r) {
|
|
1132
|
-
const
|
|
1442
|
+
const a = this;
|
|
1133
1443
|
if (n === 1) {
|
|
1134
1444
|
const o = Date.now();
|
|
1135
|
-
o - s > t && (e.apply(
|
|
1136
|
-
} else n === 2 && (
|
|
1137
|
-
|
|
1445
|
+
o - s > t && (e.apply(a, r), s = o);
|
|
1446
|
+
} else n === 2 && (i || (i = setTimeout(() => {
|
|
1447
|
+
i = null, e.apply(a, r);
|
|
1138
1448
|
}, t)));
|
|
1139
1449
|
};
|
|
1140
1450
|
},
|
|
@@ -1151,7 +1461,7 @@ const it = {
|
|
|
1151
1461
|
s++, s < Math.floor(n / t) && (e.call(this), setTimeout(this.recurve.bind(this, e, t, n), t));
|
|
1152
1462
|
}, t);
|
|
1153
1463
|
}
|
|
1154
|
-
},
|
|
1464
|
+
}, K = {
|
|
1155
1465
|
/**
|
|
1156
1466
|
* 校验字符串是否符合指定类型
|
|
1157
1467
|
*
|
|
@@ -1267,7 +1577,7 @@ const it = {
|
|
|
1267
1577
|
default:
|
|
1268
1578
|
return n || "";
|
|
1269
1579
|
}
|
|
1270
|
-
}), e.reduce((n, s,
|
|
1580
|
+
}), e.reduce((n, s, i) => `${n}${t[i - 1]}${s}`);
|
|
1271
1581
|
},
|
|
1272
1582
|
/**
|
|
1273
1583
|
* 计算字符串的字节长度
|
|
@@ -1290,10 +1600,10 @@ const it = {
|
|
|
1290
1600
|
var s = /[^\x00-\xff]/g;
|
|
1291
1601
|
if (e.replace(s, "mm").length <= n)
|
|
1292
1602
|
return e;
|
|
1293
|
-
for (var
|
|
1294
|
-
let
|
|
1295
|
-
if (
|
|
1296
|
-
return
|
|
1603
|
+
for (var i = Math.floor(n / 2), r = i; r < e.length; r++) {
|
|
1604
|
+
let a = e.substring(t, r);
|
|
1605
|
+
if (a.replace(s, "mm").length >= n)
|
|
1606
|
+
return a;
|
|
1297
1607
|
}
|
|
1298
1608
|
return e;
|
|
1299
1609
|
},
|
|
@@ -1314,20 +1624,20 @@ const it = {
|
|
|
1314
1624
|
return e;
|
|
1315
1625
|
}
|
|
1316
1626
|
}
|
|
1317
|
-
},
|
|
1627
|
+
}, mt = {
|
|
1318
1628
|
notNull(e) {
|
|
1319
1629
|
if (E.isEmpty(e))
|
|
1320
1630
|
throw Error("不能为空:>>>" + e);
|
|
1321
1631
|
},
|
|
1322
1632
|
legalLnglat(e, t) {
|
|
1323
|
-
if (!
|
|
1633
|
+
if (!j.isLnglat(e, t))
|
|
1324
1634
|
throw Error(p.COORDINATE_ERROR);
|
|
1325
1635
|
},
|
|
1326
1636
|
contain(e, ...t) {
|
|
1327
1637
|
let n = !1;
|
|
1328
1638
|
const s = t.length || 0;
|
|
1329
|
-
for (let
|
|
1330
|
-
n = e.indexOf(t[
|
|
1639
|
+
for (let i = 0, r = s; i < r; i++)
|
|
1640
|
+
n = e.indexOf(t[i]) >= 0;
|
|
1331
1641
|
if (n)
|
|
1332
1642
|
throw Error(p.STRING_CHECK_LOSS);
|
|
1333
1643
|
},
|
|
@@ -1353,7 +1663,7 @@ const it = {
|
|
|
1353
1663
|
}
|
|
1354
1664
|
},
|
|
1355
1665
|
legalData(e, t) {
|
|
1356
|
-
const n =
|
|
1666
|
+
const n = K.checkStr(e, t);
|
|
1357
1667
|
let s = "";
|
|
1358
1668
|
switch (t) {
|
|
1359
1669
|
case "phone":
|
|
@@ -1412,321 +1722,32 @@ const it = {
|
|
|
1412
1722
|
throw Error(p.PARAMETER_ERROR + ":>>>不是" + s);
|
|
1413
1723
|
}
|
|
1414
1724
|
};
|
|
1415
|
-
class ht {
|
|
1416
|
-
constructor(t) {
|
|
1417
|
-
/**
|
|
1418
|
-
* Creates an instance of AudioPlayer.
|
|
1419
|
-
* @param {*} url
|
|
1420
|
-
*/
|
|
1421
|
-
f(this, "audio");
|
|
1422
|
-
this.audio = new Audio(), this.audio.src = t;
|
|
1423
|
-
}
|
|
1424
|
-
play() {
|
|
1425
|
-
!this.muted && this.audio.play();
|
|
1426
|
-
}
|
|
1427
|
-
pause() {
|
|
1428
|
-
this.audio.pause();
|
|
1429
|
-
}
|
|
1430
|
-
get muted() {
|
|
1431
|
-
return this.audio.muted;
|
|
1432
|
-
}
|
|
1433
|
-
/**
|
|
1434
|
-
* @description 设置静音状态,如果静音,autoplay属性将失效
|
|
1435
|
-
*/
|
|
1436
|
-
set muted(t) {
|
|
1437
|
-
this.audio.muted = t;
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
class ut {
|
|
1441
|
-
constructor(t) {
|
|
1442
|
-
E.getDataType(t) === "String" && (t = document.querySelector("#" + t)), this.ctx = t.getContext("2d");
|
|
1443
|
-
}
|
|
1444
|
-
drawLine(t, n, s, a, r = {}) {
|
|
1445
|
-
this.cxt.beginPath();
|
|
1446
|
-
const i = r.width || 1, o = r.color || "#000";
|
|
1447
|
-
this.cxt.lineWidth = i, this.cxt.fillStyle = o, this.cxt.moveTo(t, n), this.cxt.lineTo(s, a), this.cxt.closePath(), this.cxt.fill();
|
|
1448
|
-
}
|
|
1449
|
-
/**
|
|
1450
|
-
* 绘制圆弧
|
|
1451
|
-
* @param {*} x 圆心X坐标
|
|
1452
|
-
* @param {*} y 圆心Y坐标
|
|
1453
|
-
* @param {*} radius 半径
|
|
1454
|
-
* @param {*} startAngle 开始的弧度
|
|
1455
|
-
* @param {*} endAngle 结束的弧度
|
|
1456
|
-
* @param {*} anticlockwise true为逆时针,false为顺时针
|
|
1457
|
-
* @param {boolean} isOnlyArc
|
|
1458
|
-
* @param {boolean} isFill 是否是填充,false为绘制边框,true为绘制填充
|
|
1459
|
-
* @param {*} bgColor 圆弧的颜色
|
|
1460
|
-
* @memberof CanvasDrawer
|
|
1461
|
-
*/
|
|
1462
|
-
drawArc(t, n, s, a, r, i, o, c) {
|
|
1463
|
-
o ? (this.cxt.fillStyle = c, this.cxt.beginPath(), this.cxt.arc(t, n, s, g.degreesToRadians(a), g.degreesToRadians(r), i), this.cxt.closePath(), this.cxt.fill()) : (this.cxt.strokeStyle = c, this.cxt.beginPath(), this.cxt.arc(t, n, s, g.degreesToRadians(a), g.degreesToRadians(r), i), this.cxt.stroke());
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
class dt {
|
|
1467
|
-
constructor(t = 1) {
|
|
1468
|
-
this.magnification = t;
|
|
1469
|
-
}
|
|
1470
|
-
// 获取系统类型
|
|
1471
|
-
_getSystem() {
|
|
1472
|
-
var t = navigator.userAgent.toLowerCase();
|
|
1473
|
-
if (t.indexOf("windows") >= 0)
|
|
1474
|
-
return !0;
|
|
1475
|
-
}
|
|
1476
|
-
// 获取页面缩放比例
|
|
1477
|
-
// _getDevicePixelRatio() {
|
|
1478
|
-
// let t = this;
|
|
1479
|
-
// }
|
|
1480
|
-
// 监听方法兼容写法
|
|
1481
|
-
_addHandler(t, n, s) {
|
|
1482
|
-
t.addEventListener ? t.addEventListener(n, s, !1) : t.attachEvent ? t.attachEvent("on" + n, s) : t["on" + n] = s;
|
|
1483
|
-
}
|
|
1484
|
-
// 校正浏览器缩放比例
|
|
1485
|
-
_correct() {
|
|
1486
|
-
let t = window.innerWidth;
|
|
1487
|
-
if (typeof t != "number" && (document.compatMode == "CSS1Compat" ? t = document.documentElement.clientWidth : t = document.body.clientWidth), t <= 750) {
|
|
1488
|
-
const s = document.documentElement.clientWidth / t;
|
|
1489
|
-
document.documentElement.style.fontSize = this.magnification * 75 * Math.min(s, 2) + "px";
|
|
1490
|
-
} else if (t > 750 && t <= 1200) {
|
|
1491
|
-
const s = document.documentElement.clientWidth / t;
|
|
1492
|
-
document.documentElement.style.fontSize = this.magnification * 85 * Math.min(s, 2) + "px";
|
|
1493
|
-
} else {
|
|
1494
|
-
const s = document.documentElement.clientWidth / 1920;
|
|
1495
|
-
document.documentElement.style.fontSize = this.magnification * 100 * Math.min(s, 2) + "px";
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
// 监听页面缩放
|
|
1499
|
-
_watch() {
|
|
1500
|
-
let t = this;
|
|
1501
|
-
t._addHandler(window, "resize", function() {
|
|
1502
|
-
t._correct();
|
|
1503
|
-
});
|
|
1504
|
-
}
|
|
1505
|
-
// 初始化页面比例
|
|
1506
|
-
init() {
|
|
1507
|
-
let t = this;
|
|
1508
|
-
t._getSystem() && (t._correct(), t._watch());
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
class K {
|
|
1512
|
-
constructor() {
|
|
1513
|
-
f(this, "_listeners");
|
|
1514
|
-
f(this, "_mutex", {});
|
|
1515
|
-
f(this, "_context");
|
|
1516
|
-
}
|
|
1517
|
-
addEventListener(t, n, s, a = !1) {
|
|
1518
|
-
this._listeners === void 0 && (this._listeners = {}), this._context = s;
|
|
1519
|
-
const r = this._mutex, i = this._listeners;
|
|
1520
|
-
return i[t] === void 0 && (i[t] = []), i[t].indexOf(n) === -1 && (a && (r[t] = n), i[t].push(n)), this;
|
|
1521
|
-
}
|
|
1522
|
-
hasEventListener(t, n) {
|
|
1523
|
-
if (this._listeners === null || this._listeners === void 0) return !1;
|
|
1524
|
-
const s = this._listeners;
|
|
1525
|
-
return s[t] !== void 0 && s[t].indexOf(n) !== -1;
|
|
1526
|
-
}
|
|
1527
|
-
removeEventListener(t, n) {
|
|
1528
|
-
if (this._listeners === void 0) return;
|
|
1529
|
-
const a = this._listeners[t];
|
|
1530
|
-
if (this._mutex[t] === n && (this._mutex[t] = null), a !== void 0) {
|
|
1531
|
-
const r = a.map((i) => i.toString()).indexOf(n.toString());
|
|
1532
|
-
r !== -1 && a.splice(r, 1);
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
dispatchEvent(t) {
|
|
1536
|
-
if (this._listeners === void 0) return;
|
|
1537
|
-
const s = this._listeners[t.type];
|
|
1538
|
-
if (s !== void 0) {
|
|
1539
|
-
t.target = this;
|
|
1540
|
-
const a = s.slice(0);
|
|
1541
|
-
if (this._mutex[t.type] !== void 0) {
|
|
1542
|
-
const r = a.find((i) => i === this._mutex[t.type]);
|
|
1543
|
-
if (r) {
|
|
1544
|
-
r.call(this._context || this, t);
|
|
1545
|
-
return;
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
for (let r = 0, i = a.length; r < i; r++) {
|
|
1549
|
-
const o = a[r];
|
|
1550
|
-
typeof o == "function" && o.call(this._context || this, t);
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1554
|
-
removeAllListener() {
|
|
1555
|
-
this._mutex = {};
|
|
1556
|
-
for (const t in this._listeners)
|
|
1557
|
-
this._listeners[t] = [];
|
|
1558
|
-
}
|
|
1559
|
-
}
|
|
1560
|
-
class F extends Map {
|
|
1561
|
-
isEmpty() {
|
|
1562
|
-
return this.size === 0;
|
|
1563
|
-
}
|
|
1564
|
-
_values() {
|
|
1565
|
-
return Array.from(this.values());
|
|
1566
|
-
}
|
|
1567
|
-
_keys() {
|
|
1568
|
-
return Array.from(this.keys());
|
|
1569
|
-
}
|
|
1570
|
-
_entries() {
|
|
1571
|
-
return Array.from(this.entries());
|
|
1572
|
-
}
|
|
1573
|
-
fromEntries() {
|
|
1574
|
-
}
|
|
1575
|
-
}
|
|
1576
|
-
F.prototype.fromEntries = function(e = []) {
|
|
1577
|
-
const t = new F();
|
|
1578
|
-
return e.forEach((n) => {
|
|
1579
|
-
Array.isArray(n) && n.length === 2 && t.set(n[0], n[1]);
|
|
1580
|
-
}), t;
|
|
1581
|
-
};
|
|
1582
|
-
class ft extends K {
|
|
1583
|
-
constructor(n = "ws://127.0.0.1:10088") {
|
|
1584
|
-
super();
|
|
1585
|
-
f(this, "maxCheckTimes", 10);
|
|
1586
|
-
f(this, "url");
|
|
1587
|
-
f(this, "checkTimes", 0);
|
|
1588
|
-
f(this, "connectStatus", !1);
|
|
1589
|
-
f(this, "client", null);
|
|
1590
|
-
this.maxCheckTimes = 10, this.url = n, this.checkTimes = 0, this.connect(), this.connCheckStatus(this.maxCheckTimes);
|
|
1591
|
-
}
|
|
1592
|
-
connect() {
|
|
1593
|
-
if (this.disconnect(), this.url)
|
|
1594
|
-
try {
|
|
1595
|
-
if (console.info("创建ws连接>>>" + this.url), this.client = new WebSocket(this.url), this.client) {
|
|
1596
|
-
const n = this;
|
|
1597
|
-
this.client.onopen = function(s) {
|
|
1598
|
-
n.dispatchEvent({
|
|
1599
|
-
type: x.WEB_SOCKET_CONNECT,
|
|
1600
|
-
message: s
|
|
1601
|
-
});
|
|
1602
|
-
}, this.client.onmessage = function(s) {
|
|
1603
|
-
n.connectStatus = !0, n.dispatchEvent({
|
|
1604
|
-
type: x.WEB_SOCKET_MESSAGE,
|
|
1605
|
-
message: s
|
|
1606
|
-
});
|
|
1607
|
-
}, this.client.onclose = function(s) {
|
|
1608
|
-
n.dispatchEvent({
|
|
1609
|
-
type: x.WEB_SOCKET_CLOSE,
|
|
1610
|
-
message: s
|
|
1611
|
-
});
|
|
1612
|
-
}, this.checkTimes === this.maxCheckTimes && (this.client.onerror = function(s) {
|
|
1613
|
-
n.dispatchEvent({
|
|
1614
|
-
type: x.WEB_SOCKET_ERROR,
|
|
1615
|
-
message: s
|
|
1616
|
-
});
|
|
1617
|
-
});
|
|
1618
|
-
}
|
|
1619
|
-
} catch (n) {
|
|
1620
|
-
console.error("创建ws连接失败" + this.url + ":" + n);
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
disconnect() {
|
|
1624
|
-
if (this.client)
|
|
1625
|
-
try {
|
|
1626
|
-
console.log("ws断开连接" + this.url), this.client.close(), this.client = null;
|
|
1627
|
-
} catch {
|
|
1628
|
-
this.client = null;
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
connCheckStatus(n) {
|
|
1632
|
-
this.checkTimes > n || setTimeout(() => {
|
|
1633
|
-
this.checkTimes++, this.client && this.client.readyState !== 0 && this.client.readyState !== 1 && this.connect(), this.connCheckStatus(n);
|
|
1634
|
-
}, 2e3);
|
|
1635
|
-
}
|
|
1636
|
-
send(n) {
|
|
1637
|
-
return this.client && this.client.readyState === 1 ? (this.client.send(n), !0) : (console.error(this.url + "消息发送失败:" + n), !1);
|
|
1638
|
-
}
|
|
1639
|
-
heartbeat() {
|
|
1640
|
-
setTimeout(() => {
|
|
1641
|
-
this.client && this.client.readyState === 1 && this.send("HeartBeat"), console.log("HeartBeat," + this.url), setTimeout(this.heartbeat, 3e4);
|
|
1642
|
-
}, 1e3);
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
class mt {
|
|
1646
|
-
constructor(t = 1) {
|
|
1647
|
-
f(this, "cacheType");
|
|
1648
|
-
f(this, "storage");
|
|
1649
|
-
if (this.cacheType = t, t === 1)
|
|
1650
|
-
this.storage = window.localStorage;
|
|
1651
|
-
else if (t === 2)
|
|
1652
|
-
this.storage = window.sessionStorage;
|
|
1653
|
-
else
|
|
1654
|
-
throw new Error(p.PARAMETER_ERROR);
|
|
1655
|
-
}
|
|
1656
|
-
/**
|
|
1657
|
-
* 设置带过期时间的LocalStorage
|
|
1658
|
-
* @param key 缓存关键字
|
|
1659
|
-
* @param value 缓存对象,可以是任意类型
|
|
1660
|
-
* @param expired 以秒为单位,默认为1小时
|
|
1661
|
-
* @returns {Object}
|
|
1662
|
-
*/
|
|
1663
|
-
setItem(t, n, s) {
|
|
1664
|
-
const a = { key: t, value: n };
|
|
1665
|
-
if (this.cacheType === 1) {
|
|
1666
|
-
const r = Date.now();
|
|
1667
|
-
s && (a.expired = r + s * 1e3);
|
|
1668
|
-
}
|
|
1669
|
-
return this.storage[t] = JSON.stringify(a), a;
|
|
1670
|
-
}
|
|
1671
|
-
/***
|
|
1672
|
-
* 获取带过期时间的缓存
|
|
1673
|
-
* @param key
|
|
1674
|
-
* @returns {null|*}
|
|
1675
|
-
*/
|
|
1676
|
-
getItem(t) {
|
|
1677
|
-
const n = this.storage.getItem(t);
|
|
1678
|
-
if (n === null)
|
|
1679
|
-
return null;
|
|
1680
|
-
const s = JSON.parse(n) || {};
|
|
1681
|
-
if (this.cacheType === 1) {
|
|
1682
|
-
const a = s.expired ? new Date(s.expired).getTime() : Date.now();
|
|
1683
|
-
if (Date.now() > a)
|
|
1684
|
-
return this.remove(t), null;
|
|
1685
|
-
}
|
|
1686
|
-
return s.value;
|
|
1687
|
-
}
|
|
1688
|
-
/**
|
|
1689
|
-
* 移除指定缓存
|
|
1690
|
-
* @param keys
|
|
1691
|
-
*/
|
|
1692
|
-
remove(t) {
|
|
1693
|
-
t && (t.indexOf(",") > -1 ? t.split(",").forEach((n) => {
|
|
1694
|
-
this.storage.removeItem(n);
|
|
1695
|
-
}) : this.storage.removeItem(t));
|
|
1696
|
-
}
|
|
1697
|
-
/**
|
|
1698
|
-
* 移出全部缓存
|
|
1699
|
-
*/
|
|
1700
|
-
clear() {
|
|
1701
|
-
this.storage.clear();
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
1725
|
export {
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1726
|
+
it as AnimateUtils,
|
|
1727
|
+
at as ArrayUtils,
|
|
1728
|
+
mt as AssertUtils,
|
|
1729
|
+
tt as AudioPlayer,
|
|
1730
|
+
ot as BrowserUtils,
|
|
1731
|
+
et as CanvasDrawer,
|
|
1732
|
+
ct as Cookie,
|
|
1733
|
+
lt as CoordsUtils,
|
|
1734
|
+
ht as DateUtils,
|
|
1735
|
+
nt as DevicePixelRatio,
|
|
1736
|
+
ut as DomUtils,
|
|
1716
1737
|
p as ErrorType,
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1738
|
+
q as EventDispatcher,
|
|
1739
|
+
b as EventType,
|
|
1740
|
+
dt as FileUtils,
|
|
1741
|
+
j as GeoUtils,
|
|
1742
|
+
V as GraphicType,
|
|
1743
|
+
U as HashMap,
|
|
1723
1744
|
Q as LayerType,
|
|
1724
1745
|
g as MathUtils,
|
|
1725
|
-
|
|
1746
|
+
X as MeasureMode,
|
|
1726
1747
|
Z as ObjectState,
|
|
1727
|
-
|
|
1728
|
-
|
|
1748
|
+
ft as OptimizeUtils,
|
|
1749
|
+
K as StringUtils,
|
|
1729
1750
|
E as Utils,
|
|
1730
|
-
|
|
1731
|
-
|
|
1751
|
+
st as WebSocketClient,
|
|
1752
|
+
rt as WebStorage
|
|
1732
1753
|
};
|