@meta2d/core 1.0.99 → 1.1.1
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.d.ts +5 -1
- package/src/canvas/canvas.js +91 -33
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.js +21 -4
- package/src/core.js.map +1 -1
- package/src/diagrams/iframe.d.ts +2 -0
- package/src/diagrams/iframe.js +46 -5
- package/src/diagrams/iframe.js.map +1 -1
- package/src/dialog/dialog.d.ts +1 -0
- package/src/dialog/dialog.js +1 -1
- package/src/dialog/dialog.js.map +1 -1
- package/src/options.d.ts +1 -0
- package/src/options.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 +143 -37
- package/src/pen/render.js.map +1 -1
- package/src/pen/text.js +8 -0
- package/src/pen/text.js.map +1 -1
- package/src/store/store.d.ts +1 -1
package/src/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { commonAnchors, commonPens, cube, reset, updateFormData } from './diagrams';
|
|
1
|
+
import { clearIframes, commonAnchors, commonPens, cube, updateIframes, reset, updateFormData } from './diagrams';
|
|
2
2
|
import { Canvas } from './canvas';
|
|
3
3
|
import { calcInView, calcTextDrawRect, calcTextLines, calcTextRect, facePen, formatAttrs, getAllChildren, getFromAnchor, getParent, getToAnchor, getWords, LockState, PenType, renderPenRaw, setElemPosition, connectLine, nearestAnchor, setChildValue, isAncestor, isShowChild, CanvasLayer, validationPlugin, setLifeCycleFunc, getAllFollowers, isInteraction, calcWorldAnchors, isDomShapes, defaultFormat, findOutliersByZScore, } from './pen';
|
|
4
4
|
import { rotatePoint } from './point';
|
|
@@ -267,6 +267,16 @@ export class Meta2d {
|
|
|
267
267
|
}
|
|
268
268
|
_value[key] = __value;
|
|
269
269
|
}
|
|
270
|
+
else if (typeof value[key] === 'string' &&
|
|
271
|
+
((value[key].startsWith('{') && value[key].endsWith('}')) ||
|
|
272
|
+
(value[key].startsWith('[') && value[key].endsWith(']')))) {
|
|
273
|
+
try {
|
|
274
|
+
_value[key] = JSON.parse(value[key]);
|
|
275
|
+
}
|
|
276
|
+
catch (e) {
|
|
277
|
+
_value[key] = value[key];
|
|
278
|
+
}
|
|
279
|
+
}
|
|
270
280
|
else {
|
|
271
281
|
_value[key] = value[key];
|
|
272
282
|
}
|
|
@@ -675,7 +685,7 @@ export class Meta2d {
|
|
|
675
685
|
else {
|
|
676
686
|
this.fitView(true, 10);
|
|
677
687
|
}
|
|
678
|
-
document.title = data.name + "-" + window.name;
|
|
688
|
+
// document.title = data.name + "-" + window.name;
|
|
679
689
|
}
|
|
680
690
|
}
|
|
681
691
|
doSendDataEvent(value, topics) {
|
|
@@ -929,6 +939,7 @@ export class Meta2d {
|
|
|
929
939
|
if (data.theme) {
|
|
930
940
|
this.setTheme(data.theme);
|
|
931
941
|
}
|
|
942
|
+
updateIframes(data.pens);
|
|
932
943
|
this.setBackgroundImage(data.bkImage, data);
|
|
933
944
|
Object.assign(this.store.data, data);
|
|
934
945
|
this.store.data.pens = [];
|
|
@@ -1851,6 +1862,7 @@ export class Meta2d {
|
|
|
1851
1862
|
step,
|
|
1852
1863
|
});
|
|
1853
1864
|
initPens = [deepClone(pen)];
|
|
1865
|
+
this.inactive();
|
|
1854
1866
|
pen.children = undefined;
|
|
1855
1867
|
// 保存修改 children 的历史记录
|
|
1856
1868
|
this.pushHistory({
|
|
@@ -1864,7 +1876,6 @@ export class Meta2d {
|
|
|
1864
1876
|
// delete 会记录 history , 更改 step 即可
|
|
1865
1877
|
this.store.histories[this.store.histories.length - 1].step = step;
|
|
1866
1878
|
}
|
|
1867
|
-
this.inactive();
|
|
1868
1879
|
}
|
|
1869
1880
|
clearCombine(pen) {
|
|
1870
1881
|
if (!pen && this.store.active) {
|
|
@@ -2546,7 +2557,7 @@ export class Meta2d {
|
|
|
2546
2557
|
if (!options.hasOwnProperty("keepalive")) {
|
|
2547
2558
|
Object.assign(options, { keepallive: 30 });
|
|
2548
2559
|
}
|
|
2549
|
-
// clean为false 时,clientId 是必填项
|
|
2560
|
+
// clean为false 时,clientId 是必填项
|
|
2550
2561
|
// if(options.clientId && !options.hasOwnProperty("clean")){
|
|
2551
2562
|
// Object.assign(options,{clean: false});
|
|
2552
2563
|
// }
|
|
@@ -4315,6 +4326,9 @@ export class Meta2d {
|
|
|
4315
4326
|
}
|
|
4316
4327
|
}
|
|
4317
4328
|
fillView() {
|
|
4329
|
+
if (this.store.options.unFill) {
|
|
4330
|
+
return; //不自适应
|
|
4331
|
+
}
|
|
4318
4332
|
const rect = this.getRect();
|
|
4319
4333
|
const wGap = this.canvas.width - rect.width;
|
|
4320
4334
|
const hGap = this.canvas.height - rect.height;
|
|
@@ -4373,6 +4387,8 @@ export class Meta2d {
|
|
|
4373
4387
|
pen.calculative.x = pen.calculative.worldRect.x;
|
|
4374
4388
|
pen.width = pen.calculative.worldRect.width;
|
|
4375
4389
|
pen.x = pen.calculative.worldRect.x;
|
|
4390
|
+
pen.textWidth *= ratio;
|
|
4391
|
+
pen.calculative.textWidth *= ratio;
|
|
4376
4392
|
this.canvas.updatePenRect(pen, { worldRectIsReady: false });
|
|
4377
4393
|
if (pen.externElement) {
|
|
4378
4394
|
pen.onResize?.(pen);
|
|
@@ -6004,6 +6020,7 @@ export class Meta2d {
|
|
|
6004
6020
|
setLifeCycleFunc = setLifeCycleFunc;
|
|
6005
6021
|
destroy(onlyData) {
|
|
6006
6022
|
this.clear(false);
|
|
6023
|
+
clearIframes();
|
|
6007
6024
|
this.stopDataMock();
|
|
6008
6025
|
this.closeSocket();
|
|
6009
6026
|
this.closeNetwork();
|