@meta2d/core 1.0.47 → 1.0.49

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/src/data.js CHANGED
@@ -79,5 +79,6 @@ export var inheritanceProps = [
79
79
  'flipX',
80
80
  'flipY',
81
81
  'lineDash',
82
+ 'visible'
82
83
  ];
83
84
  //# sourceMappingURL=data.js.map
package/src/data.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"data.js","sourceRoot":"","sources":["../../../packages/core/src/data.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,SAUX;AAVD,WAAY,SAAS;IACnB,yCAAI,CAAA;IACJ,qDAAU,CAAA;IACV,qDAAU,CAAA;IACV,yCAAI,CAAA;IACJ,yCAAI,CAAA;IACJ,6CAAM,CAAA;IACN,6CAAM,CAAA;IACN,6DAAc,CAAA;IACd,6DAAc,CAAA;AAChB,CAAC,EAVW,SAAS,KAAT,SAAS,QAUpB;AAED,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,2CAAI,CAAA;IACJ,qDAAS,CAAA;IACT,+CAAM,CAAA;IACN,+CAAM,CAAA;IACN,qDAAS,CAAA;AACX,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB;AAED,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,2CAAI,CAAA;IACJ,2CAAI,CAAA;IACJ,qDAAS,CAAA;AACX,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAED,MAAM,CAAN,IAAY,SAMX;AAND,WAAY,SAAS;IACnB,0CAAS,CAAA;IACT,qCAAE,CAAA;IACF,2CAAK,CAAA;IACL,6CAAM,CAAA;IACN,yCAAI,CAAA;AACN,CAAC,EANW,SAAS,KAAT,SAAS,QAMpB;AAED,MAAM,CAAC,IAAM,cAAc,GAAG;IAC5B,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;CACH,CAAC;AACX,MAAM,CAAC,IAAM,cAAc,GAAG;IAC5B,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;CACF,CAAC;AAEX,MAAM,CAAC,IAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAEhE,MAAM,CAAC,IAAM,gBAAgB,GAAG;IAC9B,MAAM;IACN,WAAW;IACX,SAAS;IACT,UAAU;IACV,YAAY;IACZ,OAAO;IACP,uBAAuB;IACvB,qBAAqB;IACrB,mBAAmB;IACnB,aAAa;IACb,QAAQ;IACR,YAAY;IACZ,mBAAmB;IACnB,iBAAiB;IACjB,eAAe;IACf,gBAAgB;IAChB,YAAY;IACZ,UAAU;IACV,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,WAAW;IACX,YAAY;IACZ,WAAW;IACX,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,UAAU;IACV,SAAS;IACT,OAAO;IACP,OAAO;IACP,UAAU;CACX,CAAC"}
1
+ {"version":3,"file":"data.js","sourceRoot":"","sources":["../../../packages/core/src/data.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,SAUX;AAVD,WAAY,SAAS;IACnB,yCAAI,CAAA;IACJ,qDAAU,CAAA;IACV,qDAAU,CAAA;IACV,yCAAI,CAAA;IACJ,yCAAI,CAAA;IACJ,6CAAM,CAAA;IACN,6CAAM,CAAA;IACN,6DAAc,CAAA;IACd,6DAAc,CAAA;AAChB,CAAC,EAVW,SAAS,KAAT,SAAS,QAUpB;AAED,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,2CAAI,CAAA;IACJ,qDAAS,CAAA;IACT,+CAAM,CAAA;IACN,+CAAM,CAAA;IACN,qDAAS,CAAA;AACX,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB;AAED,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,2CAAI,CAAA;IACJ,2CAAI,CAAA;IACJ,qDAAS,CAAA;AACX,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAED,MAAM,CAAN,IAAY,SAMX;AAND,WAAY,SAAS;IACnB,0CAAS,CAAA;IACT,qCAAE,CAAA;IACF,2CAAK,CAAA;IACL,6CAAM,CAAA;IACN,yCAAI,CAAA;AACN,CAAC,EANW,SAAS,KAAT,SAAS,QAMpB;AAED,MAAM,CAAC,IAAM,cAAc,GAAG;IAC5B,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;CACH,CAAC;AACX,MAAM,CAAC,IAAM,cAAc,GAAG;IAC5B,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;CACF,CAAC;AAEX,MAAM,CAAC,IAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAEhE,MAAM,CAAC,IAAM,gBAAgB,GAAG;IAC9B,MAAM;IACN,WAAW;IACX,SAAS;IACT,UAAU;IACV,YAAY;IACZ,OAAO;IACP,uBAAuB;IACvB,qBAAqB;IACrB,mBAAmB;IACnB,aAAa;IACb,QAAQ;IACR,YAAY;IACZ,mBAAmB;IACnB,iBAAiB;IACjB,eAAe;IACf,gBAAgB;IAChB,YAAY;IACZ,UAAU;IACV,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,WAAW;IACX,YAAY;IACZ,WAAW;IACX,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,UAAU;IACV,SAAS;IACT,OAAO;IACP,OAAO;IACP,UAAU;IACV,SAAS;CACV,CAAC"}
@@ -15,6 +15,7 @@ export * from './people';
15
15
  export * from './line';
16
16
  export * from './iframe';
17
17
  export * from './video';
18
+ export * from './panel';
18
19
  import { rectangle } from './rectangle';
19
20
  import { circle } from './circle';
20
21
  import { svgPath } from './svgPath';
@@ -34,6 +35,7 @@ import { video } from './video';
34
35
  import { gif } from './gif';
35
36
  import { mindNode, mindNodeAnchors } from './mindNode';
36
37
  import { mindLine, mindLineAnchors } from './mindLine';
38
+ import { panel } from './panel';
37
39
  export declare function commonPens(): {
38
40
  rectangle: typeof rectangle;
39
41
  square: typeof rectangle;
@@ -58,6 +60,7 @@ export declare function commonPens(): {
58
60
  mindNode: typeof mindNode;
59
61
  mindLine: typeof mindLine;
60
62
  mindNode2: typeof rectangle;
63
+ panel: typeof panel;
61
64
  };
62
65
  export declare function commonAnchors(): {
63
66
  triangle: typeof triangleAnchors;
@@ -15,6 +15,7 @@ export * from './people';
15
15
  export * from './line';
16
16
  export * from './iframe';
17
17
  export * from './video';
18
+ export * from './panel';
18
19
  import { rectangle, square } from './rectangle';
19
20
  import { circle } from './circle';
20
21
  import { svgPath } from './svgPath';
@@ -27,6 +28,7 @@ import { leftArrow, rightArrow, twowayArrow } from './arrow';
27
28
  import { message } from './message';
28
29
  import { cloud } from './cloud';
29
30
  import { file } from './file';
31
+ // import { cube } from './cube';
30
32
  import { people } from './people';
31
33
  import { line } from './line';
32
34
  import { iframe } from './iframe';
@@ -34,6 +36,7 @@ import { video } from './video';
34
36
  import { gif } from './gif';
35
37
  import { mindNode, mindNodeAnchors } from './mindNode';
36
38
  import { mindLine, mindLineAnchors } from './mindLine';
39
+ import { panel } from './panel';
37
40
  export function commonPens() {
38
41
  return {
39
42
  rectangle: rectangle,
@@ -58,7 +61,8 @@ export function commonPens() {
58
61
  gif: gif,
59
62
  mindNode: mindNode,
60
63
  mindLine: mindLine,
61
- mindNode2: rectangle
64
+ mindNode2: rectangle,
65
+ panel: panel
62
66
  };
63
67
  }
64
68
  export function commonAnchors() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/src/diagrams/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc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P,SAAS,WAAA;QACT,UAAU,YAAA;QACV,WAAW,aAAA;QACX,OAAO,SAAA;QACP,KAAK,OAAA;QACL,IAAI,MAAA;QACJ,MAAM,QAAA;QACN,IAAI,MAAA;QACJ,MAAM,QAAA;QACN,KAAK,OAAA;QACL,GAAG,KAAA;QACH,QAAQ,UAAA;QACR,QAAQ,UAAA;QACR,SAAS,EAAC,SAAS;QACnB,KAAK,OAAA;KACN,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO;QACL,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,eAAe;QACzB,SAAS,EAAE,gBAAgB;QAC3B,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,eAAe;KAC1B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Pen } from '../pen';
2
+ export declare function panel(pen: Pen, ctx?: CanvasRenderingContext2D): Path2D;
@@ -0,0 +1,131 @@
1
+ import { movingSuffix } from '../canvas';
2
+ import { rectInRect } from '../rect';
3
+ import { deepClone } from '../utils';
4
+ export function panel(pen, ctx) {
5
+ var path = !ctx ? new Path2D() : ctx;
6
+ if (!pen.onDestroy) {
7
+ pen.onDestroy = destory;
8
+ pen.onMove = move;
9
+ pen.onRotate = move;
10
+ pen.onMouseEnter = mouseEnter;
11
+ pen.onMouseLeave = mouseLeave;
12
+ pen.onMouseMove = mouseMove;
13
+ pen.onMouseUp = mouseUp;
14
+ pen.onInput = input;
15
+ }
16
+ var wr = pen.calculative.borderRadius || 0, hr = wr;
17
+ var _a = pen.calculative.worldRect, x = _a.x, y = _a.y, width = _a.width, height = _a.height, ex = _a.ex, ey = _a.ey;
18
+ var textX = pen.calculative.worldTextRect.x;
19
+ if (wr < 1) {
20
+ wr = width * wr;
21
+ hr = height * hr;
22
+ }
23
+ var r = wr < hr ? wr : hr;
24
+ if (width < 2 * r) {
25
+ r = width / 2;
26
+ }
27
+ if (height < 2 * r) {
28
+ r = height / 2;
29
+ }
30
+ var textWidth = getTextWidth(pen.text, pen.calculative.fontSize);
31
+ path.moveTo(x + r, y);
32
+ path.lineTo(textX - 5, y);
33
+ path.moveTo(textX + textWidth + 5, y);
34
+ path.lineTo(textX + textWidth + 5, y);
35
+ path.arcTo(ex, y, ex, ey, r);
36
+ path.arcTo(ex, ey, x, ey, r);
37
+ path.arcTo(x, ey, x, y, r);
38
+ path.arcTo(x, y, ex, y, r);
39
+ if (path instanceof Path2D) {
40
+ return path;
41
+ }
42
+ }
43
+ function getTextWidth(text, fontSize) {
44
+ // 近似计算
45
+ var chinese = text.match(/[^\x00-\xff]/g) || '';
46
+ var chineseWidth = chinese.length * fontSize; // 中文占用的宽度
47
+ var spaces = text.match(/\s/g) || '';
48
+ var spaceWidth = spaces.length * fontSize * 0.3; // 空格占用的宽度
49
+ var otherWidth = (text.length - chinese.length - spaces.length) * fontSize * 0.6; // 其他字符占用的宽度
50
+ var currentWidth = chineseWidth + spaceWidth + otherWidth;
51
+ return currentWidth;
52
+ }
53
+ function input(pen, text) {
54
+ pen.text = text;
55
+ pen.calculative.text = pen.text;
56
+ // this.inputDiv.dataset.penId = undefined;
57
+ pen.calculative.canvas.updatePenRect(pen);
58
+ // this.patchFlags = true;
59
+ // this.store.emitter.emit('valueUpdate', pen);
60
+ }
61
+ function destory(pen) { }
62
+ function move(pen) { }
63
+ function mouseEnter(pen) {
64
+ // const activePens = pen.calculative.canvas.store.active;
65
+ // if(activePens&&activePens.length){
66
+ // activePens.forEach((activePen:Pen)=>{
67
+ // if(rectInRect(activePen.calculative.worldRect,pen.calculative.worldRect,true)){
68
+ // if(!pen.followers){
69
+ // pen.followers =[];
70
+ // }
71
+ // if(!pen.followers.includes(activePen.id)){
72
+ // pen.followers.push(activePen.id);
73
+ // }
74
+ // }
75
+ // })
76
+ // }
77
+ }
78
+ function mouseLeave(pen) {
79
+ var activePens = pen.calculative.canvas.store.active;
80
+ if (activePens && activePens.length) {
81
+ activePens.forEach(function (activePen) {
82
+ // if(!rectInRect(activePen.calculative.worldRect,pen.calculative.worldRect,true)){
83
+ // if(!pen.followers){
84
+ // pen.followers =[];
85
+ // }
86
+ // if(!pen.followers.includes(activePen.id)){
87
+ // pen.followers.push(activePen.id);
88
+ // }
89
+ // }
90
+ if (pen.followers) {
91
+ var idx = pen.followers.findIndex(function (id) { return id === activePen.id; });
92
+ if (idx !== -1) {
93
+ var movingPen = pen.calculative.canvas.store.pens[activePen.id + movingSuffix];
94
+ if (movingPen && movingPen.calculative) {
95
+ var isIn = rectInRect(movingPen.calculative.worldRect, pen.calculative.worldRect, true);
96
+ if (!isIn) {
97
+ pen.followers.splice(idx, 1);
98
+ }
99
+ }
100
+ }
101
+ }
102
+ });
103
+ }
104
+ }
105
+ function mouseUp(pen) {
106
+ var activePens = pen.calculative.canvas.store.active;
107
+ if (activePens && activePens.length) {
108
+ activePens.forEach(function (activePen) {
109
+ var movingPen = pen.calculative.canvas.store.pens[activePen.id + movingSuffix];
110
+ if (movingPen && movingPen.calculative) {
111
+ var inRect = deepClone(pen.calculative.worldRect);
112
+ inRect.x -= 1;
113
+ inRect.y -= 1;
114
+ inRect.width += 2;
115
+ inRect.height += 2;
116
+ if (rectInRect(movingPen.calculative.worldRect, inRect, true)) {
117
+ if (!pen.followers) {
118
+ pen.followers = [];
119
+ }
120
+ if (!pen.followers.includes(activePen.id)) {
121
+ pen.followers.push(activePen.id);
122
+ }
123
+ }
124
+ }
125
+ });
126
+ }
127
+ }
128
+ function mouseMove(pen, e) {
129
+ // console.log(e,pen.calculative.canvas.store.active);
130
+ }
131
+ //# sourceMappingURL=panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel.js","sourceRoot":"","sources":["../../../../packages/core/src/diagrams/panel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAA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KAAK,IAAI,CAAC,CAAC;gBAClB,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;gBACnB,IAAI,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;oBAC7D,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE;wBAClB,GAAG,CAAC,SAAS,GAAG,EAAE,CAAC;qBACpB;oBACD,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE;wBACzC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;qBAClC;iBACF;aACF;QACH,CAAC,CAAC,CAAC;KACJ;AACH,CAAC;AAED,SAAS,SAAS,CAAC,GAAQ,EAAE,CAAQ;IACnC,uDAAuD;AACzD,CAAC"}
package/src/options.d.ts CHANGED
@@ -27,6 +27,8 @@ export interface Options {
27
27
  textAlign?: TextAlign;
28
28
  textBaseline?: TextBaseline;
29
29
  rotateCursor?: string;
30
+ rightCursor?: string;
31
+ downCursor?: string;
30
32
  hoverCursor?: string;
31
33
  disableInput?: boolean;
32
34
  disableRotate?: boolean;
@@ -92,6 +94,7 @@ export interface Options {
92
94
  polylineSpace?: number;
93
95
  defaultFormat?: Pen;
94
96
  domShapes?: string[];
97
+ containerShapes?: string[];
95
98
  textFlip?: boolean;
96
99
  textRotate?: boolean;
97
100
  cacheLength?: number;
@@ -106,6 +109,9 @@ export interface Options {
106
109
  padding?: Padding;
107
110
  resizeMode?: boolean;
108
111
  svgPathStroke?: boolean;
112
+ disabledColor?: string;
113
+ disabledBackground?: string;
114
+ scaleOff?: number;
109
115
  }
110
116
  export declare const defaultOptions: Options;
111
117
  export interface PenPlugin {
package/src/options.js CHANGED
@@ -21,6 +21,8 @@ export var defaultOptions = {
21
21
  dockPenColor: '#1890FF',
22
22
  dragColor: '#1890ff',
23
23
  rotateCursor: 'rotate.cur',
24
+ rightCursor: 'right.cur',
25
+ downCursor: 'down.cur',
24
26
  hoverCursor: 'pointer',
25
27
  minScale: 0.1,
26
28
  maxScale: 10,
@@ -68,6 +70,7 @@ export var defaultOptions = {
68
70
  cdn: '',
69
71
  polylineSpace: 10,
70
72
  domShapes: [],
73
+ containerShapes: ['table'],
71
74
  textFlip: true,
72
75
  textRotate: true,
73
76
  unavailableKeys: [],
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../packages/core/src/options.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8CAAS,CAAA;IACT,qDAAQ,CAAA;IACR,iDAAM,CAAA;AACR,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAsGD,MAAM,CAAC,IAAM,cAAc,GAAY;IACrC,UAAU,EACR,2EAA2E;IAC7E,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,GAAG;IACf,SAAS,EAAE,QAAQ;IACnB,YAAY,EAAE,QAAQ;IACtB,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,SAAS;IACtB,UAAU,EAAE,uBAAuB;IACnC,WAAW,EAAE,SAAS;IACtB,gBAAgB,EAAE,SAAS;IAC3B,YAAY,EAAE,CAAC;IACf,gBAAgB,EAAE,MAAM;IACxB,SAAS,EAAE,uBAAuB;IAClC,YAAY,EAAE,SAAS;IACvB,SAAS,EAAE,SAAS;IACpB,YAAY,EAAE,YAAY;IAC1B,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,GAAG;IACb,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,WAAW,CAAC,QAAQ;IAC7B,QAAQ,EAAE,EAAE;IACZ,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,eAAe,EAAE,OAAO;IACxB,QAAQ,EAAE,EAAE;IACZ,eAAe,EAAE,EAAE;IACnB,YAAY,EAAE,IAAI;IAClB,UAAU,EAAE,IAAI;IAChB,aAAa,EAAE,KAAK;IACpB,YAAY,EAAE,SAAS;IACvB,aAAa,EAAE,SAAS;IACxB,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC;IAChB,UAAU,EAAE,EAAE;IACd,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,CAAC;IACd,cAAc,EAAE;QACd;YACE,CAAC,EAAE,GAAG;YACN,CAAC,EAAE,CAAC;SACL;QACD;YACE,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,GAAG;SACP;QACD;YACE,CAAC,EAAE,GAAG;YACN,CAAC,EAAE,CAAC;SACL;QACD;YACE,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,GAAG;SACP;KACF;IACD,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,gBAAgB,EAAE,IAAI;IACtB,gBAAgB,EAAE,KAAK;IACvB,iBAAiB,EAAE,CAAC;IACpB,oBAAoB,EAAE,KAAK;IAC3B,GAAG,EAAE,EAAE;IACP,aAAa,EAAE,EAAE;IACjB,SAAS,EAAE,EAAE;IACb,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,IAAI;IAChB,eAAe,EAAE,EAAE;IACnB,cAAc,EAAE,EAAE;IAClB,aAAa,EAAC,IAAI;CACnB,CAAC"}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../packages/core/src/options.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8CAAS,CAAA;IACT,qDAAQ,CAAA;IACR,iDAAM,CAAA;AACR,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AA4GD,MAAM,CAAC,IAAM,cAAc,GAAY;IACrC,UAAU,EACR,2EAA2E;IAC7E,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,GAAG;IACf,SAAS,EAAE,QAAQ;IACnB,YAAY,EAAE,QAAQ;IACtB,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,SAAS;IACtB,UAAU,EAAE,uBAAuB;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,EAAC,CAAC,OAAO,CAAC;IACzB,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,IAAI;IAChB,eAAe,EAAE,EAAE;IACnB,cAAc,EAAE,EAAE;IAClB,aAAa,EAAC,IAAI;CACnB,CAAC"}
@@ -164,6 +164,7 @@ export interface Pen extends Rect {
164
164
  backgroundImage?: string;
165
165
  strokeImage?: string;
166
166
  children?: string[];
167
+ followers?: string[];
167
168
  anchors?: Point[];
168
169
  anchorRadius?: number;
169
170
  anchorBackground?: string;
@@ -252,6 +253,14 @@ export interface Pen extends Rect {
252
253
  apiHeaders?: any;
253
254
  apiBody?: any;
254
255
  apiEnable?: boolean;
256
+ container?: boolean;
257
+ disabled?: boolean;
258
+ disabledColor?: string;
259
+ disabledBackground?: string;
260
+ disabledTextColor?: string;
261
+ inputType?: string;
262
+ deviceId?: string;
263
+ pivot?: Point;
255
264
  calculative?: {
256
265
  x?: number;
257
266
  y?: number;
@@ -351,6 +360,7 @@ export interface Pen extends Rect {
351
360
  active?: boolean;
352
361
  focus?: boolean;
353
362
  hover?: boolean;
363
+ containerHover?: boolean;
354
364
  isDock?: boolean;
355
365
  pencil?: boolean;
356
366
  activeAnchor?: Point;
@@ -406,6 +416,10 @@ export interface Pen extends Rect {
406
416
  cssDisplay?: string;
407
417
  animations?: any[];
408
418
  imageRadius?: number;
419
+ disabled?: boolean;
420
+ disabledColor?: string;
421
+ disabledBackground?: string;
422
+ disabledTextColor?: string;
409
423
  };
410
424
  lastConnected?: any;
411
425
  textDecoration?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../packages/core/src/pen/model.ts"],"names":[],"mappings":"AAKA,MAAM,CAAN,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,qCAAI,CAAA;IACJ,qCAAI,CAAA;AACN,CAAC,EAHW,OAAO,KAAP,OAAO,QAGlB;AAED,MAAM,CAAN,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,yCAAI,CAAA;IACJ,u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IACxB,GAAG,CAAC,aAAa,GAAG,SAAS,CAAC;AAChC,CAAC"}
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../packages/core/src/pen/model.ts"],"names":[],"mappings":"AAKA,MAAM,CAAN,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,qCAAI,CAAA;IACJ,qCAAI,CAAA;AACN,CAAC,EAHW,OAAO,KAAP,OAAO,QAGlB;AAED,MAAM,CAAN,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,yCAAI,CAAA;IACJ,uDAAW,CAAA;IACX,uDAAW,CAAA;IACX,yDAAY,CAAA;IACZ,iEAAgB,CAAA;IAChB,iBAAiB;IACjB,gDAAY,CAAA;AACd,CAAC,EARW,SAAS,KAAT,SAAS,QAQpB;AAED,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,iDAAO,CAAA;IACP,uCAAE,CAAA;IACF,yCAAG,CAAA;AACL,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAED,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,uCAAI,CAAA;IACJ,2CAAM,CAAA;IACN,2CAAM,CAAA;AACR,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB;AAED,oBAAoB;AACpB,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,iEAAkB,CAAA;IAClB,uEAAiB,CAAA;IACjB,yDAAU,CAAA;IACV,2DAAW,CAAA,CAAC,OAAO;AACrB,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB;AAED,qBAAqB;AACrB,gBAAgB;AAChB,wBAAwB;AACxB,sBAAsB;AACtB,iBAAiB;AACjB,IAAI;AAEJ,wBAAwB;AACxB,MAAM,CAAC,IAAM,qBAAqB,GAAG;IACnC,MAAM;IACN,WAAW;IACX,YAAY;IACZ,UAAU;IACV,SAAS;IACT,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,WAAW;IACX,cAAc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,CAAC,YAAY,GAAG,SAAS,CAAC;IAC7B,GAAG,CAAC,YAAY,GAAG,SAAS,CAAC;IAC7B,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC;IAC5B,GAAG,CAAC,cAAc,GAAG,SAAS,CAAC;IAC/B,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC;IAC1B,GAAG,CAAC,aAAa,GAAG,SAAS,CAAC;IAC9B,GAAG,CAAC,OAAO,GAAG,SAAS,CAAC;IACxB,GAAG,CAAC,OAAO,GAAG,SAAS,CAAC;IACxB,GAAG,CAAC,aAAa,GAAG,SAAS,CAAC;AAChC,CAAC"}
@@ -12,6 +12,7 @@ import { Meta2dStore } from '../store';
12
12
  export declare function isAncestor(pen: Pen, ancestor: Pen): boolean;
13
13
  export declare function getParent(pen: Pen, root?: boolean): Pen;
14
14
  export declare function getAllChildren(pen: Pen, store: Meta2dStore): Pen[];
15
+ export declare function getAllFollowers(pen: Pen, store: Meta2dStore): Pen[];
15
16
  export declare function getGradientAnimatePath(pen: Pen): Path2D;
16
17
  export declare function drawImage(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, pen: Pen): void;
17
18
  /**
package/src/pen/render.js CHANGED
@@ -49,13 +49,13 @@ import { CanvasLayer, LineAnimateType, LockState, } from './model';
49
49
  import { drawArrow, getLineRect, getSplitAnchor } from '../diagrams';
50
50
  import { Direction, inheritanceProps } from '../data';
51
51
  import { calcRotate, distance, facePoint, rotatePoint, scalePoint, translatePoint, TwoWay, } from '../point';
52
- import { calcCenter, calcRightBottom, calcRelativePoint, calcRelativeRect, rectInRect, scaleRect, translateRect, } from '../rect';
52
+ import { calcCenter, calcRightBottom, calcRelativePoint, calcRelativeRect, rectInRect, scaleRect, translateRect, calcPivot } from '../rect';
53
53
  import { globalStore } from '../store';
54
54
  import { calcTextLines, calcTextDrawRect, calcTextRect } from './text';
55
55
  import { deepClone } from '../utils/clone';
56
56
  import { renderFromArrow, renderToArrow } from './arrow';
57
57
  import { Gradient, PenType } from '@meta2d/core';
58
- import { rgba } from '../utils';
58
+ import { pSBC, rgba } from '../utils';
59
59
  /**
60
60
  * ancestor 是否是 pen 的祖先
61
61
  * @param pen 当前画笔
@@ -99,6 +99,20 @@ export function getAllChildren(pen, store) {
99
99
  });
100
100
  return children;
101
101
  }
102
+ export function getAllFollowers(pen, store) {
103
+ if (!pen || !pen.followers) {
104
+ return [];
105
+ }
106
+ var followers = [];
107
+ pen.followers.forEach(function (id) {
108
+ var follower = store.pens[id];
109
+ if (follower && !follower.parentId) {
110
+ followers.push(follower);
111
+ followers.push.apply(followers, __spreadArray([], __read(getAllFollowers(follower, store)), false));
112
+ }
113
+ });
114
+ return followers;
115
+ }
102
116
  function drawBkLinearGradient(ctx, pen) {
103
117
  var _a = pen.calculative, worldRect = _a.worldRect, gradientFromColor = _a.gradientFromColor, gradientToColor = _a.gradientToColor, gradientAngle = _a.gradientAngle;
104
118
  return linearGradient(ctx, worldRect, gradientFromColor, gradientToColor, gradientAngle);
@@ -747,7 +761,10 @@ function drawText(ctx, pen) {
747
761
  ctx.shadowOffsetY = 0;
748
762
  }
749
763
  var fill = undefined;
750
- if (pen.calculative.hover) {
764
+ if (pen.calculative.disabled) {
765
+ fill = pen.disabledTextColor || pen.disabledColor || pSBC(0.4, getTextColor(pen, store));
766
+ }
767
+ else if (pen.calculative.hover) {
751
768
  fill = pen.hoverTextColor || pen.hoverColor || store.options.hoverColor;
752
769
  }
753
770
  else if (pen.calculative.active) {
@@ -1018,7 +1035,7 @@ export function ctxFlip(ctx, pen) {
1018
1035
  }
1019
1036
  export function ctxRotate(ctx, pen, noFlip) {
1020
1037
  if (noFlip === void 0) { noFlip = false; }
1021
- var _a = pen.calculative.worldRect.center, x = _a.x, y = _a.y;
1038
+ var _a = pen.calculative.worldRect.pivot || pen.calculative.worldRect.center, x = _a.x, y = _a.y;
1022
1039
  ctx.translate(x, y);
1023
1040
  var rotate = (pen.calculative.rotate * Math.PI) / 180;
1024
1041
  // 目前只有水平和垂直翻转,都需要 * -1
@@ -1057,7 +1074,11 @@ export function renderPen(ctx, pen, download) {
1057
1074
  // let setBack = true;
1058
1075
  var lineGradientFlag = false;
1059
1076
  var _stroke = undefined;
1060
- if (pen.calculative.hover) {
1077
+ if (pen.calculative.disabled) {
1078
+ _stroke = pen.disabledColor || store.options.disabledColor || pSBC(0.4, pen.calculative.color || getGlobalColor(store));
1079
+ fill = pen.disabledBackground || store.options.disabledBackground || pSBC(0.4, pen.calculative.background || store.data.penBackground);
1080
+ }
1081
+ else if (pen.calculative.hover) {
1061
1082
  _stroke = pen.hoverColor || store.options.hoverColor;
1062
1083
  fill = pen.hoverBackground || store.options.hoverBackground;
1063
1084
  // ctx.fillStyle = fill;
@@ -1254,6 +1275,7 @@ export function renderPenRaw(ctx, pen, rect, download) {
1254
1275
  // for canvas2svg
1255
1276
  (_c = (_b = ctx).setAttrs) === null || _c === void 0 ? void 0 : _c.call(_b, pen);
1256
1277
  // end
1278
+ var lineGradientFlag = false;
1257
1279
  var store = pen.calculative.canvas.store;
1258
1280
  var textFlip = pen.textFlip || store.options.textFlip;
1259
1281
  var textRotate = pen.textRotate || store.options.textRotate;
@@ -1304,7 +1326,14 @@ export function renderPenRaw(ctx, pen, rect, download) {
1304
1326
  }
1305
1327
  }
1306
1328
  else {
1307
- ctx.strokeStyle = pen.calculative.color || getGlobalColor(store);
1329
+ var stroke = void 0;
1330
+ if (pen.calculative.strokeType && pen.calculative.lineGradientColors && pen.name === 'line') {
1331
+ lineGradientFlag = true;
1332
+ }
1333
+ else {
1334
+ stroke = pen.calculative.color || getGlobalColor(store);
1335
+ }
1336
+ ctx.strokeStyle = stroke;
1308
1337
  }
1309
1338
  if (pen.backgroundImage) {
1310
1339
  if (pen.calculative.backgroundImg) {
@@ -1332,8 +1361,14 @@ export function renderPenRaw(ctx, pen, rect, download) {
1332
1361
  ctx.shadowOffsetY = pen.calculative.shadowOffsetY;
1333
1362
  ctx.shadowBlur = pen.calculative.shadowBlur;
1334
1363
  }
1335
- ctxDrawPath(false, ctx, pen, store, fill);
1336
- ctxDrawCanvas(ctx, pen);
1364
+ if (lineGradientFlag) {
1365
+ ctxDrawLinearGradientPath(ctx, pen);
1366
+ ctxDrawLinePath(true, ctx, pen, store);
1367
+ }
1368
+ else {
1369
+ ctxDrawPath(false, ctx, pen, store, fill);
1370
+ ctxDrawCanvas(ctx, pen);
1371
+ }
1337
1372
  // renderPenRaw 用在 downloadPng svg , echarts 等图形需要
1338
1373
  if (pen.calculative.img) {
1339
1374
  ctx.save();
@@ -1752,6 +1787,9 @@ export function calcWorldRects(pen) {
1752
1787
  rect.rotate = pen.rotate;
1753
1788
  calcRightBottom(rect);
1754
1789
  calcCenter(rect);
1790
+ if (pen.pivot) {
1791
+ calcPivot(rect, pen.pivot);
1792
+ }
1755
1793
  }
1756
1794
  else {
1757
1795
  var parent_1 = store.pens[pen.parentId];
@@ -1776,6 +1814,9 @@ export function calcWorldRects(pen) {
1776
1814
  calcRightBottom(rect);
1777
1815
  rect.rotate = parentRect.rotate + pen.rotate;
1778
1816
  calcCenter(rect);
1817
+ if (pen.pivot) {
1818
+ calcPivot(rect, pen.pivot);
1819
+ }
1779
1820
  }
1780
1821
  pen.calculative.worldRect = rect;
1781
1822
  // 这里的 rect 均是绝对值
@@ -1797,7 +1838,8 @@ export function calcPadding(pen, rect) {
1797
1838
  (pen.calculative.paddingRight *= rect.width);
1798
1839
  }
1799
1840
  export function calcPenRect(pen) {
1800
- var worldRect = pen.calculative.worldRect;
1841
+ var worldRect = deepClone(pen.calculative.worldRect);
1842
+ delete worldRect.pivot;
1801
1843
  if (!pen.parentId) {
1802
1844
  Object.assign(pen, worldRect);
1803
1845
  return;
@@ -1841,7 +1883,7 @@ export function calcWorldAnchors(pen) {
1841
1883
  }
1842
1884
  if (pen.calculative.rotate) {
1843
1885
  anchors.forEach(function (anchor) {
1844
- rotatePoint(anchor, pen.calculative.rotate, pen.calculative.worldRect.center);
1886
+ rotatePoint(anchor, pen.calculative.rotate, pen.calculative.worldRect.pivot || pen.calculative.worldRect.center);
1845
1887
  });
1846
1888
  }
1847
1889
  if (!pen.type || pen.anchors) {
@@ -1916,9 +1958,9 @@ export function calcIconRect(pens, pen) {
1916
1958
  calcCenter(pen.calculative.worldIconRect);
1917
1959
  }
1918
1960
  export function scalePen(pen, scale, center) {
1919
- scaleRect(pen.calculative.worldRect, scale, center);
1961
+ scaleRect(pen.calculative.worldRect, scale, center, pen.pivot);
1920
1962
  if (pen.calculative.initRect) {
1921
- scaleRect(pen.calculative.initRect, scale, center);
1963
+ scaleRect(pen.calculative.initRect, scale, center, pen.pivot);
1922
1964
  }
1923
1965
  if (pen.calculative.x) {
1924
1966
  scalePoint(pen.calculative, scale, center);
@@ -2314,7 +2356,7 @@ export function initPrevFrame(pen) {
2314
2356
  }
2315
2357
  // 根据process进度值(纯小数),计算节点动画属性
2316
2358
  export function setNodeAnimateProcess(pen, process) {
2317
- var _a;
2359
+ var _a, _b;
2318
2360
  if (process < 0) {
2319
2361
  return;
2320
2362
  }
@@ -2408,6 +2450,10 @@ export function setNodeAnimateProcess(pen, process) {
2408
2450
  pen.calculative.canvas.canvasImage.init();
2409
2451
  }
2410
2452
  }
2453
+ else if ((_b = pen.children) === null || _b === void 0 ? void 0 : _b.length) {
2454
+ var childs = getAllChildren(pen, pen.calculative.canvas.store);
2455
+ pen.calculative.canvas.initImageCanvas(childs);
2456
+ }
2411
2457
  }
2412
2458
  pen.calculative[k] = frame[k];
2413
2459
  var v = {};
@@ -2656,7 +2702,7 @@ function initLineRect(pen) {
2656
2702
  * @returns
2657
2703
  */
2658
2704
  export function getPensDisableResize(pens) {
2659
- return pens.every(function (pen) { return pen.disableSize; });
2705
+ return pens.every(function (pen) { return pen.disableSize || pen.pivot; }); //旋转中心点图元不允许改变大小
2660
2706
  }
2661
2707
  export function getFrameValue(pen, prop, frameIndex) {
2662
2708
  if (!pen.frames || !prop) {