@meta2d/core 1.0.58 → 1.0.59

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 CHANGED
@@ -1,38 +1,39 @@
1
1
  {
2
- "name": "@meta2d/core",
3
- "version": "1.0.58",
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
- "build": "tsc"
9
- },
10
- "keywords": [
11
- "meta2d",
12
- "diagram",
13
- "2D",
14
- "canvas"
15
- ],
16
- "author": "alsmile123@qq.com",
17
- "license": "MIT",
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/le5le-com/meta2d.js.git"
21
- },
22
- "bugs": {
23
- "url": "https://github.com/le5le-com/meta2d.js/issues"
24
- },
25
- "homepage": "https://github.com/le5le-com/meta2d.js#readme",
26
- "devDependencies": {
27
- "@types/marked": "^4.0.3",
28
- "@types/offscreencanvas": "latest"
29
- },
30
- "dependencies": {
31
- "mitt": "^2.1.0",
32
- "mqtt": "^4.2.6"
33
- },
34
- "publishConfig": {
35
- "access": "public"
36
- },
37
- "gitHead": "78f2a53ca1839c89b56e2e498d17ba4eb987ad14"
2
+ "name": "@meta2d/core",
3
+ "version": "1.0.59",
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
  }
@@ -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.calculative.focus) {
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
- this.store.pens[key] && (this.store.pens[key].connectedLines =
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.showInput(this.store.hover);
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', {