@meta2d/core 1.0.67 → 1.0.69
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/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/canvas/canvas.d.ts +1 -0
- package/src/canvas/canvas.js +41 -10
- package/src/canvas/canvas.js.map +1 -1
- package/src/canvas/canvasImage.js +1 -1
- package/src/canvas/canvasImage.js.map +1 -1
- package/src/canvas/canvasTemplate.js +2 -1
- package/src/canvas/canvasTemplate.js.map +1 -1
- package/src/core.js +59 -30
- package/src/core.js.map +1 -1
- package/src/diagrams/form.d.ts +5 -0
- package/src/diagrams/{panel.js → form.js} +47 -6
- package/src/diagrams/form.js.map +1 -0
- package/src/diagrams/gif.js +30 -19
- package/src/diagrams/gif.js.map +1 -1
- package/src/diagrams/index.d.ts +3 -3
- package/src/diagrams/index.js +3 -3
- package/src/diagrams/index.js.map +1 -1
- package/src/event/event.d.ts +1 -1
- package/src/event/event.js.map +1 -1
- package/src/pen/model.d.ts +5 -0
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.d.ts +1 -1
- package/src/pen/render.js +115 -37
- package/src/pen/render.js.map +1 -1
- package/src/store/store.d.ts +1 -0
- package/src/store/store.js +1 -1
- package/src/store/store.js.map +1 -1
- package/src/theme.d.ts +55 -0
- package/src/theme.js +185 -0
- package/src/theme.js.map +1 -1
- package/src/utils/url.d.ts +6 -0
- package/src/utils/url.js +21 -5
- package/src/utils/url.js.map +1 -1
- package/src/diagrams/panel.d.ts +0 -2
- package/src/diagrams/panel.js.map +0 -1
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../packages/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../packages/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
package/package.json
CHANGED
package/src/canvas/canvas.d.ts
CHANGED
package/src/canvas/canvas.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { KeydownType } from '../options';
|
|
2
|
-
import { addLineAnchor, calcIconRect, calcTextRect, calcWorldAnchors, calcWorldRects, LockState, nearestAnchor, PenType, pushPenAnchor, removePenAnchor, renderPen, scalePen, translateLine, deleteTempAnchor, connectLine, disconnectLine, getAnchor, calcAnchorDock, calcMoveDock, calcTextLines, setNodeAnimate, setLineAnimate, calcPenRect, setChildrenActive, getParent, setHover, randomId, getPensLock, getToAnchor, getFromAnchor, calcPadding, getPensDisableRotate, getPensDisableResize, needCalcTextRectProps, calcResizeDock, needPatchFlagsPenRectProps, needCalcIconRectProps, isDomShapes, renderPenRaw, needSetPenProps, getAllChildren, calcInView, isShowChild, getTextColor,
|
|
2
|
+
import { addLineAnchor, calcIconRect, calcTextRect, calcWorldAnchors, calcWorldRects, LockState, nearestAnchor, PenType, pushPenAnchor, removePenAnchor, renderPen, scalePen, translateLine, deleteTempAnchor, connectLine, disconnectLine, getAnchor, calcAnchorDock, calcMoveDock, calcTextLines, setNodeAnimate, setLineAnimate, calcPenRect, setChildrenActive, getParent, setHover, randomId, getPensLock, getToAnchor, getFromAnchor, calcPadding, getPensDisableRotate, getPensDisableResize, needCalcTextRectProps, calcResizeDock, needPatchFlagsPenRectProps, needCalcIconRectProps, isDomShapes, renderPenRaw, needSetPenProps, getAllChildren, calcInView, isShowChild, getTextColor, clearLifeCycle, rotatePen, calcTextAutoWidth, getGradientAnimatePath, CanvasLayer, ctxFlip, ctxRotate, setGlobalAlpha, drawImage, setElemPosition, getAllFollowers, calcChildrenInitRect, } from '../pen';
|
|
3
3
|
import { calcRotate, distance, getDistance, hitPoint, PointType, PrevNextType, rotatePoint, samePoint, scalePoint, translatePoint, TwoWay, } from '../point';
|
|
4
4
|
import { calcCenter, calcRightBottom, calcRelativePoint, getRect, getRectOfPoints, pointInRect, pointInSimpleRect, rectInRect, rectToPoints, resizeRect, translateRect, pointInPolygon } from '../rect';
|
|
5
5
|
import { EditType, globalStore, } from '../store';
|
|
@@ -19,6 +19,7 @@ import { Title } from '../title';
|
|
|
19
19
|
import { CanvasTemplate } from './canvasTemplate';
|
|
20
20
|
import { getLinePoints } from '../diagrams/line';
|
|
21
21
|
import { Popconfirm } from '../popconfirm';
|
|
22
|
+
import { themeKeys } from '../theme';
|
|
22
23
|
export const movingSuffix = '-moving';
|
|
23
24
|
export class Canvas {
|
|
24
25
|
parent;
|
|
@@ -4027,6 +4028,27 @@ export class Canvas {
|
|
|
4027
4028
|
pen.calculative.gradientTimer = undefined;
|
|
4028
4029
|
}, 50);
|
|
4029
4030
|
}
|
|
4031
|
+
initGlobalStyle() {
|
|
4032
|
+
const options = {};
|
|
4033
|
+
const data = {};
|
|
4034
|
+
const theme = {};
|
|
4035
|
+
themeKeys.forEach(key => {
|
|
4036
|
+
if (this.store.options[key] !== undefined) {
|
|
4037
|
+
options[key] = this.store.options[key];
|
|
4038
|
+
}
|
|
4039
|
+
if (this.store.data[key] !== undefined) {
|
|
4040
|
+
data[key] = this.store.data[key];
|
|
4041
|
+
}
|
|
4042
|
+
if (this.store.data.theme) {
|
|
4043
|
+
const value = this.store.theme[this.store.data.theme]?.[key];
|
|
4044
|
+
if (value !== undefined) {
|
|
4045
|
+
theme[key] = value;
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
});
|
|
4049
|
+
this.store.globalStyle = {};
|
|
4050
|
+
Object.assign(this.store.globalStyle, options, data, theme);
|
|
4051
|
+
}
|
|
4030
4052
|
render = (patchFlags) => {
|
|
4031
4053
|
if (patchFlags) {
|
|
4032
4054
|
this.opening = false;
|
|
@@ -4078,7 +4100,7 @@ export class Canvas {
|
|
|
4078
4100
|
};
|
|
4079
4101
|
renderPens = () => {
|
|
4080
4102
|
const ctx = this.offscreen.getContext('2d');
|
|
4081
|
-
ctx.strokeStyle = getGlobalColor(this.store);
|
|
4103
|
+
ctx.strokeStyle = this.store.globalStyle.color; //getGlobalColor(this.store);
|
|
4082
4104
|
for (const pen of this.store.data.pens) {
|
|
4083
4105
|
if (!isFinite(pen.x)) {
|
|
4084
4106
|
continue;
|
|
@@ -4145,7 +4167,7 @@ export class Canvas {
|
|
|
4145
4167
|
ctx.rotate((this.activeRect.rotate * Math.PI) / 180);
|
|
4146
4168
|
ctx.translate(-pivot.x, -pivot.y);
|
|
4147
4169
|
}
|
|
4148
|
-
ctx.strokeStyle = this.store.
|
|
4170
|
+
ctx.strokeStyle = this.store.globalStyle.activeColor;
|
|
4149
4171
|
ctx.globalAlpha = this.store.options.activeGlobalAlpha === undefined ? 0.3 : this.store.options.activeGlobalAlpha;
|
|
4150
4172
|
ctx.beginPath();
|
|
4151
4173
|
ctx.lineWidth = this.store.options.activeLineWidth || 1;
|
|
@@ -4167,7 +4189,7 @@ export class Canvas {
|
|
|
4167
4189
|
ctx.stroke();
|
|
4168
4190
|
// Draw rotate control points.
|
|
4169
4191
|
ctx.beginPath();
|
|
4170
|
-
ctx.strokeStyle = this.store.
|
|
4192
|
+
ctx.strokeStyle = this.store.globalStyle.activeColor;
|
|
4171
4193
|
ctx.fillStyle = '#ffffff';
|
|
4172
4194
|
ctx.arc(this.activeRect.center.x, this.activeRect.y - 30, 5, 0, Math.PI * 2);
|
|
4173
4195
|
ctx.fill();
|
|
@@ -4195,7 +4217,7 @@ export class Canvas {
|
|
|
4195
4217
|
}
|
|
4196
4218
|
if (anchors) {
|
|
4197
4219
|
ctx.strokeStyle =
|
|
4198
|
-
this.store.hover.anchorColor || this.store.
|
|
4220
|
+
this.store.hover.anchorColor || this.store.globalStyle.anchorColor;
|
|
4199
4221
|
ctx.fillStyle =
|
|
4200
4222
|
this.store.hover.anchorBackground ||
|
|
4201
4223
|
this.store.options.anchorBackground;
|
|
@@ -4251,7 +4273,7 @@ export class Canvas {
|
|
|
4251
4273
|
if (this.store.hover.type && this.store.hoverAnchor === anchor) {
|
|
4252
4274
|
ctx.save();
|
|
4253
4275
|
ctx.strokeStyle =
|
|
4254
|
-
this.store.hover.activeColor || this.store.
|
|
4276
|
+
this.store.hover.activeColor || this.store.globalStyle.activeColor;
|
|
4255
4277
|
ctx.fillStyle = ctx.strokeStyle;
|
|
4256
4278
|
}
|
|
4257
4279
|
else if (anchor.color || anchor.background) {
|
|
@@ -4299,7 +4321,7 @@ export class Canvas {
|
|
|
4299
4321
|
if (!getPensLock(this.store.active) &&
|
|
4300
4322
|
!getPensDisableResize(this.store.active) &&
|
|
4301
4323
|
!this.store.options.disableSize) {
|
|
4302
|
-
ctx.strokeStyle = this.store.
|
|
4324
|
+
ctx.strokeStyle = this.store.globalStyle.activeColor;
|
|
4303
4325
|
ctx.fillStyle = '#ffffff';
|
|
4304
4326
|
this.sizeCPs.forEach((pt, i) => {
|
|
4305
4327
|
if (this.activeRect.rotate) {
|
|
@@ -5796,7 +5818,7 @@ export class Canvas {
|
|
|
5796
5818
|
offset && (this.store.clipboard.offset = offset);
|
|
5797
5819
|
pos && (this.store.clipboard.pos = pos);
|
|
5798
5820
|
}
|
|
5799
|
-
if (!this.keyOptions
|
|
5821
|
+
if (!this.keyOptions?.F) {
|
|
5800
5822
|
this.store.clipboard.pens.forEach((pen) => {
|
|
5801
5823
|
delete pen.copyIndex;
|
|
5802
5824
|
});
|
|
@@ -6760,6 +6782,13 @@ export class Canvas {
|
|
|
6760
6782
|
const child = this.store.pens[childId];
|
|
6761
6783
|
child.parentId = newId;
|
|
6762
6784
|
});
|
|
6785
|
+
//form表单关系
|
|
6786
|
+
if (pen.formId) {
|
|
6787
|
+
pen.followers.forEach((id) => {
|
|
6788
|
+
const followerPen = this.store.pens[id];
|
|
6789
|
+
followerPen.formId = newId;
|
|
6790
|
+
});
|
|
6791
|
+
}
|
|
6763
6792
|
// 连接关系
|
|
6764
6793
|
if (pen.type === PenType.Line) {
|
|
6765
6794
|
// TODO: 仍然存在 节点类型的 连线,此处判断需要更改
|
|
@@ -7067,7 +7096,8 @@ export class Canvas {
|
|
|
7067
7096
|
// }
|
|
7068
7097
|
ctx.textBaseline = 'middle'; // 默认垂直居中
|
|
7069
7098
|
ctx.scale(scale, scale);
|
|
7070
|
-
const background = this.store.
|
|
7099
|
+
const background = this.store.globalStyle.background;
|
|
7100
|
+
// this.store.data.background || this.store.options.background;
|
|
7071
7101
|
if (background && isV) {
|
|
7072
7102
|
// 绘制背景颜色
|
|
7073
7103
|
ctx.save();
|
|
@@ -7176,7 +7206,8 @@ export class Canvas {
|
|
|
7176
7206
|
const ctx = canvas.getContext('2d');
|
|
7177
7207
|
ctx.textBaseline = 'middle'; // 默认垂直居中
|
|
7178
7208
|
ctx.scale(scale, scale);
|
|
7179
|
-
const background = this.store.
|
|
7209
|
+
const background = this.store.globalStyle.background;
|
|
7210
|
+
// this.store.data.background || this.store.options.background;
|
|
7180
7211
|
if (background) {
|
|
7181
7212
|
// 绘制背景颜色
|
|
7182
7213
|
ctx.save();
|