@meta2d/core 1.0.69 → 1.0.70
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.js +18 -11
- 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 +1 -1
- package/src/canvas/canvasTemplate.js.map +1 -1
- package/src/core.js +5 -5
- package/src/core.js.map +1 -1
- package/src/pen/model.js +1 -0
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.js +33 -33
- package/src/pen/render.js.map +1 -1
- package/src/store/store.d.ts +1 -1
- package/src/theme.js +2 -0
- package/src/theme.js.map +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.js
CHANGED
|
@@ -4046,8 +4046,8 @@ export class Canvas {
|
|
|
4046
4046
|
}
|
|
4047
4047
|
}
|
|
4048
4048
|
});
|
|
4049
|
-
this.store.
|
|
4050
|
-
Object.assign(this.store.
|
|
4049
|
+
this.store.styles = {};
|
|
4050
|
+
Object.assign(this.store.styles, options, data, theme);
|
|
4051
4051
|
}
|
|
4052
4052
|
render = (patchFlags) => {
|
|
4053
4053
|
if (patchFlags) {
|
|
@@ -4100,7 +4100,7 @@ export class Canvas {
|
|
|
4100
4100
|
};
|
|
4101
4101
|
renderPens = () => {
|
|
4102
4102
|
const ctx = this.offscreen.getContext('2d');
|
|
4103
|
-
ctx.strokeStyle = this.store.
|
|
4103
|
+
ctx.strokeStyle = this.store.styles.color; //getGlobalColor(this.store);
|
|
4104
4104
|
for (const pen of this.store.data.pens) {
|
|
4105
4105
|
if (!isFinite(pen.x)) {
|
|
4106
4106
|
continue;
|
|
@@ -4167,7 +4167,7 @@ export class Canvas {
|
|
|
4167
4167
|
ctx.rotate((this.activeRect.rotate * Math.PI) / 180);
|
|
4168
4168
|
ctx.translate(-pivot.x, -pivot.y);
|
|
4169
4169
|
}
|
|
4170
|
-
ctx.strokeStyle = this.store.
|
|
4170
|
+
ctx.strokeStyle = this.store.styles.activeColor;
|
|
4171
4171
|
ctx.globalAlpha = this.store.options.activeGlobalAlpha === undefined ? 0.3 : this.store.options.activeGlobalAlpha;
|
|
4172
4172
|
ctx.beginPath();
|
|
4173
4173
|
ctx.lineWidth = this.store.options.activeLineWidth || 1;
|
|
@@ -4189,7 +4189,7 @@ export class Canvas {
|
|
|
4189
4189
|
ctx.stroke();
|
|
4190
4190
|
// Draw rotate control points.
|
|
4191
4191
|
ctx.beginPath();
|
|
4192
|
-
ctx.strokeStyle = this.store.
|
|
4192
|
+
ctx.strokeStyle = this.store.styles.activeColor;
|
|
4193
4193
|
ctx.fillStyle = '#ffffff';
|
|
4194
4194
|
ctx.arc(this.activeRect.center.x, this.activeRect.y - 30, 5, 0, Math.PI * 2);
|
|
4195
4195
|
ctx.fill();
|
|
@@ -4217,7 +4217,7 @@ export class Canvas {
|
|
|
4217
4217
|
}
|
|
4218
4218
|
if (anchors) {
|
|
4219
4219
|
ctx.strokeStyle =
|
|
4220
|
-
this.store.hover.anchorColor || this.store.
|
|
4220
|
+
this.store.hover.anchorColor || this.store.styles.anchorColor;
|
|
4221
4221
|
ctx.fillStyle =
|
|
4222
4222
|
this.store.hover.anchorBackground ||
|
|
4223
4223
|
this.store.options.anchorBackground;
|
|
@@ -4273,7 +4273,7 @@ export class Canvas {
|
|
|
4273
4273
|
if (this.store.hover.type && this.store.hoverAnchor === anchor) {
|
|
4274
4274
|
ctx.save();
|
|
4275
4275
|
ctx.strokeStyle =
|
|
4276
|
-
this.store.hover.activeColor || this.store.
|
|
4276
|
+
this.store.hover.activeColor || this.store.styles.activeColor;
|
|
4277
4277
|
ctx.fillStyle = ctx.strokeStyle;
|
|
4278
4278
|
}
|
|
4279
4279
|
else if (anchor.color || anchor.background) {
|
|
@@ -4321,7 +4321,7 @@ export class Canvas {
|
|
|
4321
4321
|
if (!getPensLock(this.store.active) &&
|
|
4322
4322
|
!getPensDisableResize(this.store.active) &&
|
|
4323
4323
|
!this.store.options.disableSize) {
|
|
4324
|
-
ctx.strokeStyle = this.store.
|
|
4324
|
+
ctx.strokeStyle = this.store.styles.activeColor;
|
|
4325
4325
|
ctx.fillStyle = '#ffffff';
|
|
4326
4326
|
this.sizeCPs.forEach((pt, i) => {
|
|
4327
4327
|
if (this.activeRect.rotate) {
|
|
@@ -7096,7 +7096,7 @@ export class Canvas {
|
|
|
7096
7096
|
// }
|
|
7097
7097
|
ctx.textBaseline = 'middle'; // 默认垂直居中
|
|
7098
7098
|
ctx.scale(scale, scale);
|
|
7099
|
-
const background = this.store.
|
|
7099
|
+
const background = this.store.data.background || this.store.styles.background;
|
|
7100
7100
|
// this.store.data.background || this.store.options.background;
|
|
7101
7101
|
if (background && isV) {
|
|
7102
7102
|
// 绘制背景颜色
|
|
@@ -7138,7 +7138,11 @@ export class Canvas {
|
|
|
7138
7138
|
else {
|
|
7139
7139
|
// 平移画布,画笔的 worldRect 不变化
|
|
7140
7140
|
if (isV) {
|
|
7141
|
-
ctx.translate(
|
|
7141
|
+
// ctx.translate(
|
|
7142
|
+
// -oldRect.x + p[3] * _scale || 0,
|
|
7143
|
+
// -oldRect.y + p[0] * _scale || 0
|
|
7144
|
+
// );
|
|
7145
|
+
ctx.translate(-rect.x, -rect.y);
|
|
7142
7146
|
}
|
|
7143
7147
|
else {
|
|
7144
7148
|
ctx.translate((isRight ? storeData.x : -oldRect.x) + p[3] * _scale || 0, (isBottom ? storeData.y : -oldRect.y) + p[0] * _scale || 0);
|
|
@@ -7206,7 +7210,7 @@ export class Canvas {
|
|
|
7206
7210
|
const ctx = canvas.getContext('2d');
|
|
7207
7211
|
ctx.textBaseline = 'middle'; // 默认垂直居中
|
|
7208
7212
|
ctx.scale(scale, scale);
|
|
7209
|
-
const background = this.store.
|
|
7213
|
+
const background = this.store.data.background || this.store.styles.background;
|
|
7210
7214
|
// this.store.data.background || this.store.options.background;
|
|
7211
7215
|
if (background) {
|
|
7212
7216
|
// 绘制背景颜色
|
|
@@ -7223,6 +7227,9 @@ export class Canvas {
|
|
|
7223
7227
|
if (!isShowChild(pen, this.store) || pen.visible == false) {
|
|
7224
7228
|
continue;
|
|
7225
7229
|
}
|
|
7230
|
+
if (pen.name === 'combine' && !pen.draw) {
|
|
7231
|
+
continue;
|
|
7232
|
+
}
|
|
7226
7233
|
const { active } = pen.calculative;
|
|
7227
7234
|
pen.calculative.active = false;
|
|
7228
7235
|
if (pen.calculative.img) {
|