@meta2d/core 1.0.58 → 1.0.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/package.json +37 -36
- package/src/canvas/canvas.js +47 -6
- package/src/canvas/canvas.js.map +1 -1
- package/src/canvas/canvasImage.js +3 -0
- package/src/canvas/canvasImage.js.map +1 -1
- package/src/canvas/canvasTemplate.js +4 -2
- package/src/canvas/canvasTemplate.js.map +1 -1
- package/src/core.d.ts +9 -1
- package/src/core.js +101 -22
- package/src/core.js.map +1 -1
- package/src/diagrams/index.d.ts +1 -0
- package/src/diagrams/index.js +2 -1
- package/src/diagrams/index.js.map +1 -1
- package/src/dialog/dialog.js +1 -1
- package/src/dialog/dialog.js.map +1 -1
- package/src/options.d.ts +5 -0
- package/src/options.js.map +1 -1
- package/src/pen/model.d.ts +1 -0
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.js +1 -1
- package/src/pen/render.js.map +1 -1
- package/src/store/store.d.ts +1 -0
- package/src/store/store.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
2
|
+
"name": "@meta2d/core",
|
|
3
|
+
"version": "1.0.60",
|
|
4
|
+
"description": "@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"copy": "copyfiles package.json ../../dist/core/",
|
|
9
|
+
"build": "tsc && npm run copy"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"meta2d",
|
|
13
|
+
"diagram",
|
|
14
|
+
"2D",
|
|
15
|
+
"canvas"
|
|
16
|
+
],
|
|
17
|
+
"author": "alsmile123@qq.com",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/le5le-com/meta2d.js.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/le5le-com/meta2d.js/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/le5le-com/meta2d.js#readme",
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/marked": "^4.0.3",
|
|
29
|
+
"@types/offscreencanvas": "latest"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"mitt": "^2.1.0",
|
|
33
|
+
"mqtt": "^4.2.6"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"gitHead": "78f2a53ca1839c89b56e2e498d17ba4eb987ad14"
|
|
38
39
|
}
|
package/src/canvas/canvas.js
CHANGED
|
@@ -1652,6 +1652,13 @@ export class Canvas {
|
|
|
1652
1652
|
case HoverType.Node:
|
|
1653
1653
|
case HoverType.Line:
|
|
1654
1654
|
if (this.store.hover) {
|
|
1655
|
+
if (this.store.active?.length && this.store.active.length === 1) {
|
|
1656
|
+
if (this.store.hover.id === this.store.active[0].id) {
|
|
1657
|
+
//准备移动子图元
|
|
1658
|
+
this.calcActiveRect();
|
|
1659
|
+
break;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1655
1662
|
const parentPen = getParent(this.store.hover, true);
|
|
1656
1663
|
let pen = parentPen || this.store.hover;
|
|
1657
1664
|
if (parentPen && (parentPen.container || this.store.options.containerShapes?.includes(parentPen.name))) {
|
|
@@ -2001,9 +2008,8 @@ export class Canvas {
|
|
|
2001
2008
|
return;
|
|
2002
2009
|
}
|
|
2003
2010
|
if (this.mouseRight === MouseRight.Down) {
|
|
2004
|
-
if (this.store.hover && this.store.hover.
|
|
2005
|
-
this.store.hover.onContextmenu
|
|
2006
|
-
this.store.hover.onContextmenu(this.store.hover, e);
|
|
2011
|
+
if (this.store.hover && this.store.hover.onContextmenu) {
|
|
2012
|
+
this.store.hover.onContextmenu(this.store.hover, e);
|
|
2007
2013
|
}
|
|
2008
2014
|
else {
|
|
2009
2015
|
this.store.emitter.emit('contextmenu', {
|
|
@@ -2391,6 +2397,10 @@ export class Canvas {
|
|
|
2391
2397
|
pen.calculative.y + pen.calculative.height;
|
|
2392
2398
|
}
|
|
2393
2399
|
calcChildrenInitRect(pen);
|
|
2400
|
+
if (pen.parentId) {
|
|
2401
|
+
//移动子图元,更新整个组件
|
|
2402
|
+
this.parent.updateRectbyChild(pen.calculative.worldRect, pen, this.store.pens[pen.parentId]);
|
|
2403
|
+
}
|
|
2394
2404
|
});
|
|
2395
2405
|
// active 消息表示拖拽结束
|
|
2396
2406
|
// this.store.emitter.emit('active', this.store.active);
|
|
@@ -3344,8 +3354,17 @@ export class Canvas {
|
|
|
3344
3354
|
if (this.store.data.pens[i].type &&
|
|
3345
3355
|
this.store.data.pens[i].lastConnected) {
|
|
3346
3356
|
for (let key in this.store.data.pens[i].lastConnected) {
|
|
3347
|
-
|
|
3348
|
-
this.store.data.pens[i].lastConnected[key]);
|
|
3357
|
+
if (this.store.pens[key]) {
|
|
3358
|
+
let connected = deepClone(this.store.data.pens[i].lastConnected[key]);
|
|
3359
|
+
this.store.pens[key].connectedLines = connected;
|
|
3360
|
+
pen.anchors.forEach((anchor) => {
|
|
3361
|
+
connected.forEach((item) => {
|
|
3362
|
+
if (anchor.id === item.lineAnchor) {
|
|
3363
|
+
anchor.connectTo = key;
|
|
3364
|
+
}
|
|
3365
|
+
});
|
|
3366
|
+
});
|
|
3367
|
+
}
|
|
3349
3368
|
}
|
|
3350
3369
|
}
|
|
3351
3370
|
this.store.data.pens[i] = pen;
|
|
@@ -4023,6 +4042,9 @@ export class Canvas {
|
|
|
4023
4042
|
if (pen.canvasLayer === CanvasLayer.CanvasTemplate) {
|
|
4024
4043
|
continue;
|
|
4025
4044
|
}
|
|
4045
|
+
if (pen.name === 'combine' && !pen.draw) {
|
|
4046
|
+
continue;
|
|
4047
|
+
}
|
|
4026
4048
|
if (pen.calculative.inView) {
|
|
4027
4049
|
if (pen.canvasLayer === CanvasLayer.CanvasMain &&
|
|
4028
4050
|
pen.name !== 'gif' &&
|
|
@@ -5986,6 +6008,10 @@ export class Canvas {
|
|
|
5986
6008
|
this.store.data.pens.splice(i, 1);
|
|
5987
6009
|
this.store.pens[pen.id] = undefined;
|
|
5988
6010
|
delete this.store.pens[pen.id];
|
|
6011
|
+
// 删除svgpath的数据
|
|
6012
|
+
if (pen.pathId) {
|
|
6013
|
+
delete this.store.data.paths[pen.pathId];
|
|
6014
|
+
}
|
|
5989
6015
|
}
|
|
5990
6016
|
this.store.animates.delete(pen);
|
|
5991
6017
|
this.store.animateMap.delete(pen);
|
|
@@ -6042,7 +6068,21 @@ export class Canvas {
|
|
|
6042
6068
|
this.store.hover.onShowInput(this.store.hover, e);
|
|
6043
6069
|
}
|
|
6044
6070
|
else {
|
|
6045
|
-
this.
|
|
6071
|
+
if (this.store.hover && this.store.hover.parentId) {
|
|
6072
|
+
if (this.store.active?.length === 1 && this.store.active[0].id === this.store.hover.id) {
|
|
6073
|
+
this.showInput(this.store.hover);
|
|
6074
|
+
}
|
|
6075
|
+
else {
|
|
6076
|
+
this.store.pens[this.store.hover.parentId].children.forEach((id) => {
|
|
6077
|
+
this.store.pens[id].calculative.active = false;
|
|
6078
|
+
this.store.pens[id].calculative.hover = false;
|
|
6079
|
+
});
|
|
6080
|
+
this.active([this.store.hover]);
|
|
6081
|
+
}
|
|
6082
|
+
}
|
|
6083
|
+
else {
|
|
6084
|
+
this.showInput(this.store.hover);
|
|
6085
|
+
}
|
|
6046
6086
|
}
|
|
6047
6087
|
}
|
|
6048
6088
|
this.store.emitter.emit('dblclick', {
|
|
@@ -7579,6 +7619,7 @@ export class Canvas {
|
|
|
7579
7619
|
window && window.removeEventListener('message', this.onMessage);
|
|
7580
7620
|
window && window.removeEventListener('resize', this.onResize);
|
|
7581
7621
|
window && window.removeEventListener('scroll', this.onScroll);
|
|
7622
|
+
this.parentElement.innerHTML = '';
|
|
7582
7623
|
}
|
|
7583
7624
|
}
|
|
7584
7625
|
//# sourceMappingURL=canvas.js.map
|