@meta2d/core 1.0.90 → 1.0.92
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/package.json +1 -1
- package/src/canvas/canvas.js +15 -5
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.js +41 -26
- package/src/core.js.map +1 -1
- package/src/diagrams/iframe.js +9 -9
- package/src/diagrams/iframe.js.map +1 -1
- package/src/pen/model.d.ts +4 -0
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.js +13 -15
- package/src/pen/render.js.map +1 -1
- package/src/pen/text.js +3 -2
- package/src/pen/text.js.map +1 -1
- package/src/utils/tool.d.ts +9 -0
- package/src/utils/tool.js +24 -0
- package/src/utils/tool.js.map +1 -1
- package/src/utils/url.d.ts +1 -0
- package/src/utils/url.js +2 -2
- package/src/utils/url.js.map +1 -1
package/src/core.js
CHANGED
|
@@ -13,7 +13,7 @@ import pkg from '../package.json';
|
|
|
13
13
|
import { lockedError } from './utils/error';
|
|
14
14
|
import { Scroll } from './scroll';
|
|
15
15
|
import { getter } from './utils/object';
|
|
16
|
-
import { getCookie, getMeta2dData, getToken, queryURLParams } from './utils/url';
|
|
16
|
+
import { d, getCookie, getMeta2dData, getToken, queryURLParams } from './utils/url';
|
|
17
17
|
import { HotkeyType } from './data';
|
|
18
18
|
import { Message, messageList } from './message';
|
|
19
19
|
import { closeJetLinks, connectJetLinks, getSendData, sendJetLinksData } from './utils/jetLinks';
|
|
@@ -1261,15 +1261,21 @@ export class Meta2d {
|
|
|
1261
1261
|
});
|
|
1262
1262
|
});
|
|
1263
1263
|
});
|
|
1264
|
+
if (!this.store.data.iot) {
|
|
1265
|
+
this.store.data.iot = {};
|
|
1266
|
+
}
|
|
1264
1267
|
if (devices.length) {
|
|
1265
|
-
if (!this.store.data.iot) {
|
|
1266
|
-
this.store.data.iot = {};
|
|
1267
|
-
}
|
|
1268
1268
|
this.store.data.iot.devices = devices;
|
|
1269
1269
|
}
|
|
1270
|
+
else {
|
|
1271
|
+
delete this.store.data.iot.devices;
|
|
1272
|
+
}
|
|
1270
1273
|
if (properties.length) {
|
|
1271
1274
|
this.store.data.iot.list = properties;
|
|
1272
1275
|
}
|
|
1276
|
+
else {
|
|
1277
|
+
delete this.store.data.iot.list;
|
|
1278
|
+
}
|
|
1273
1279
|
}
|
|
1274
1280
|
connectSocket() {
|
|
1275
1281
|
this.connectWebsocket();
|
|
@@ -2019,6 +2025,7 @@ export class Meta2d {
|
|
|
2019
2025
|
return getAllFollowers(pen, this.store);
|
|
2020
2026
|
}
|
|
2021
2027
|
data() {
|
|
2028
|
+
this.initBinds();
|
|
2022
2029
|
const data = deepClone(this.store.data);
|
|
2023
2030
|
const { pens, paths } = this.store.data;
|
|
2024
2031
|
data.version = pkg.version;
|
|
@@ -2516,11 +2523,11 @@ export class Meta2d {
|
|
|
2516
2523
|
Object.assign(options, { keepallive: 30 });
|
|
2517
2524
|
}
|
|
2518
2525
|
// clean为false 时,clientId 是必填项
|
|
2519
|
-
if
|
|
2520
|
-
|
|
2521
|
-
}
|
|
2526
|
+
// if(options.clientId && !options.hasOwnProperty("clean")){
|
|
2527
|
+
// Object.assign(options,{clean: false});
|
|
2528
|
+
// }
|
|
2522
2529
|
if (!options.hasOwnProperty("reconnectPeriod")) {
|
|
2523
|
-
Object.assign(options, { reconnectPeriod:
|
|
2530
|
+
Object.assign(options, { reconnectPeriod: 5000 });
|
|
2524
2531
|
}
|
|
2525
2532
|
if (!options.hasOwnProperty("connectTimeout")) {
|
|
2526
2533
|
Object.assign(options, { connectTimeout: 10 * 1000 });
|
|
@@ -2538,24 +2545,25 @@ export class Meta2d {
|
|
|
2538
2545
|
this.mqttClients[net.index].on('error', (error) => {
|
|
2539
2546
|
this.store.emitter.emit('error', { type: 'mqtt', error });
|
|
2540
2547
|
});
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
}
|
|
2548
|
+
//mqtt 默认重连配置 reconnectPeriod
|
|
2549
|
+
// let reconnectDelay = 1000;
|
|
2550
|
+
// this.mqttClients[net.index].on('close', () => {
|
|
2551
|
+
// if (this.store.options.reconnetTimes) {
|
|
2552
|
+
// net.times++;
|
|
2553
|
+
// if (net.times >= this.store.options.reconnetTimes) {
|
|
2554
|
+
// net.times = 0;
|
|
2555
|
+
// this.mqttClients && this.mqttClients[net.index]?.end();
|
|
2556
|
+
// }
|
|
2557
|
+
// setTimeout(()=>{
|
|
2558
|
+
// if (net.times < this.store.options.reconnetTimes) {
|
|
2559
|
+
// this.mqttClients[net.index].reconnect(options as any);
|
|
2560
|
+
// reconnectDelay = Math.min(reconnectDelay * 2, 10 * 1000);
|
|
2561
|
+
// }
|
|
2562
|
+
// },reconnectDelay)
|
|
2563
|
+
// }
|
|
2564
|
+
// });
|
|
2557
2565
|
this.mqttClients[net.index].on('connect', (connack) => {
|
|
2558
|
-
reconnectDelay = 1000;
|
|
2566
|
+
// reconnectDelay = 1000;
|
|
2559
2567
|
if (!connack.sessionPresent) {
|
|
2560
2568
|
// 创建了新会话或没有找到旧会话,需要重新订阅主题
|
|
2561
2569
|
if (net.topics) {
|
|
@@ -2942,8 +2950,15 @@ export class Meta2d {
|
|
|
2942
2950
|
// }
|
|
2943
2951
|
//获取动态参数
|
|
2944
2952
|
getDynamicParam(key) {
|
|
2953
|
+
let lsValue = localStorage.getItem(key);
|
|
2954
|
+
if (globalThis.le5leTokenD) {
|
|
2955
|
+
let tokenkeys = [globalThis.le5leSSOTokenName ?? 'ssotoken', globalThis.le5leTokenName ?? 'token'];
|
|
2956
|
+
if (tokenkeys.includes(key)) {
|
|
2957
|
+
lsValue = d(lsValue);
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2945
2960
|
let params = queryURLParams();
|
|
2946
|
-
let value = params[key] ||
|
|
2961
|
+
let value = params[key] || lsValue || getCookie(key) || globalThis[key] || '';
|
|
2947
2962
|
return value;
|
|
2948
2963
|
}
|
|
2949
2964
|
onNetworkConnect(https) {
|