@meta2d/core 1.0.69 → 1.0.71

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@meta2d/core",
3
- "version": "1.0.69",
3
+ "version": "1.0.71",
4
4
  "description": "@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -4046,8 +4046,8 @@ export class Canvas {
4046
4046
  }
4047
4047
  }
4048
4048
  });
4049
- this.store.globalStyle = {};
4050
- Object.assign(this.store.globalStyle, options, data, theme);
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.globalStyle.color; //getGlobalColor(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.globalStyle.activeColor;
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.globalStyle.activeColor;
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.globalStyle.anchorColor;
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.globalStyle.activeColor;
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.globalStyle.activeColor;
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.globalStyle.background;
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(-oldRect.x + p[3] * _scale || 0, -oldRect.y + p[0] * _scale || 0);
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.globalStyle.background;
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) {