@meta2d/core 1.0.66 → 1.0.67

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.66",
3
+ "version": "1.0.67",
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",
@@ -6051,7 +6051,9 @@ export class Canvas {
6051
6051
  const i = this.store.data.pens.findIndex((item) => item.id === pen.id);
6052
6052
  if (i > -1) {
6053
6053
  const delPen = this.store.pens[pen.id];
6054
- delPen.calculative.active = undefined;
6054
+ if (delPen && delPen.calculative) {
6055
+ delPen.calculative.active = undefined;
6056
+ }
6055
6057
  delPens.push(delPen);
6056
6058
  }
6057
6059
  if (pen.children) {
@@ -6995,7 +6997,7 @@ export class Canvas {
6995
6997
  const oldRect = deepClone(rect);
6996
6998
  const storeData = this.store.data;
6997
6999
  // TODO: 目前背景颜色优先级更高
6998
- const isDrawBkImg = containBkImg && !storeData.background && this.store.bkImg;
7000
+ const isDrawBkImg = containBkImg && this.store.bkImg;
6999
7001
  // 主体在背景的右侧,下侧
7000
7002
  let isRight = false, isBottom = false;
7001
7003
  if (isDrawBkImg) {
@@ -7066,16 +7068,11 @@ export class Canvas {
7066
7068
  ctx.textBaseline = 'middle'; // 默认垂直居中
7067
7069
  ctx.scale(scale, scale);
7068
7070
  const background = this.store.data.background || this.store.options.background;
7069
- if (background) {
7071
+ if (background && isV) {
7070
7072
  // 绘制背景颜色
7071
7073
  ctx.save();
7072
7074
  ctx.fillStyle = background;
7073
- if (isV) {
7074
- ctx.fillRect(0, 0, vRect.width + (p[1] + p[3]) * _scale, vRect.height + (p[0] + p[2]) * _scale);
7075
- }
7076
- else {
7077
- ctx.fillRect(0, 0, oldRect.width + (p[3] + p[1]) * _scale, oldRect.height + (p[0] + p[2]) * _scale);
7078
- }
7075
+ ctx.fillRect(0, 0, vRect.width + (p[1] + p[3]) * _scale, vRect.height + (p[0] + p[2]) * _scale);
7079
7076
  ctx.restore();
7080
7077
  }
7081
7078
  if (isDrawBkImg) {
@@ -7088,6 +7085,23 @@ export class Canvas {
7088
7085
  ctx.drawImage(this.store.bkImg, x, y, this.canvasRect.width, this.canvasRect.height);
7089
7086
  }
7090
7087
  }
7088
+ if (background && !isV) {
7089
+ // 绘制背景颜色
7090
+ if (isDrawBkImg) {
7091
+ const x = rect.x < 0 ? -rect.x : 0;
7092
+ const y = rect.y < 0 ? -rect.y : 0;
7093
+ ctx.save();
7094
+ ctx.fillStyle = background;
7095
+ ctx.fillRect(x, y, this.canvasRect.width, this.canvasRect.height);
7096
+ ctx.restore();
7097
+ }
7098
+ else {
7099
+ ctx.save();
7100
+ ctx.fillStyle = background;
7101
+ ctx.fillRect(0, 0, oldRect.width + (p[3] + p[1]) * _scale, oldRect.height + (p[0] + p[2]) * _scale);
7102
+ ctx.restore();
7103
+ }
7104
+ }
7091
7105
  if (!isDrawBkImg) {
7092
7106
  ctx.translate(-rect.x, -rect.y);
7093
7107
  }