@meta2d/core 1.0.84-alpha.1 → 1.0.84

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.84-alpha.1",
3
+ "version": "1.0.84",
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",
@@ -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, clearLifeCycle, rotatePen, calcTextAutoWidth, getGradientAnimatePath, CanvasLayer, ctxFlip, ctxRotate, setGlobalAlpha, drawImage, setElemPosition, getAllFollowers, calcChildrenInitRect, } from '../pen';
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, needImgCanvasPatchFlagsProps, } 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';
@@ -2256,6 +2256,9 @@ export class Canvas {
2256
2256
  this.store.hover.onShowInput(this.store.hover, e);
2257
2257
  }
2258
2258
  else {
2259
+ if (this.store.hover.parentId) {
2260
+ this.active([this.store.hover]);
2261
+ }
2259
2262
  this.showInput(this.store.hover);
2260
2263
  }
2261
2264
  }
@@ -4177,9 +4180,9 @@ export class Canvas {
4177
4180
  if (pen.canvasLayer === CanvasLayer.CanvasTemplate) {
4178
4181
  continue;
4179
4182
  }
4180
- if (pen.name === 'combine' && !pen.draw) {
4181
- continue;
4182
- }
4183
+ // if (pen.name === 'combine' && !pen.draw){
4184
+ // continue;
4185
+ // }
4183
4186
  if (pen.calculative.inView) {
4184
4187
  if (pen.canvasLayer === CanvasLayer.CanvasMain &&
4185
4188
  pen.name !== 'gif' &&
@@ -4211,9 +4214,9 @@ export class Canvas {
4211
4214
  };
4212
4215
  renderPenContainChild = (ctx, pen) => {
4213
4216
  if (pen.calculative.inView) {
4214
- if (!(pen.name === 'combine' && !pen.draw)) {
4215
- renderPen(ctx, pen); // 可见才绘制,组合为状态只显示其中一个
4216
- }
4217
+ // if (!(pen.name === 'combine' && !pen.draw)){
4218
+ renderPen(ctx, pen); // 可见才绘制,组合为状态只显示其中一个
4219
+ // }
4217
4220
  }
4218
4221
  pen.children?.forEach((id) => {
4219
4222
  const child = this.store.pens[id];
@@ -6954,7 +6957,7 @@ export class Canvas {
6954
6957
  if (needCalcIconRectProps.includes(k)) {
6955
6958
  willCalcIconRect = true;
6956
6959
  }
6957
- if (pen.image && pen.name !== 'gif' && ['globalAlpha', 'flipY', 'flipX', 'x', 'y', 'width', 'height', 'iconWidth', 'iconHeight', 'imageRatio', 'iconLeft', 'iconTop', 'iconAlign', 'rotate', 'visible'].includes(k)) {
6960
+ if (pen.image && pen.name !== 'gif' && needImgCanvasPatchFlagsProps.includes(k)) {
6958
6961
  willRenderImage = true;
6959
6962
  }
6960
6963
  }
@@ -7193,7 +7196,7 @@ export class Canvas {
7193
7196
  // }
7194
7197
  ctx.textBaseline = 'middle'; // 默认垂直居中
7195
7198
  ctx.scale(scale, scale);
7196
- const background = this.store.data.background || this.store.styles.background;
7199
+ const background = this.store.options.downloadBgTransparent ? undefined : (this.store.data.background || this.store.styles.background);
7197
7200
  // this.store.data.background || this.store.options.background;
7198
7201
  if (background && isV) {
7199
7202
  // 绘制背景颜色
@@ -7250,9 +7253,9 @@ export class Canvas {
7250
7253
  if (!isShowChild(pen, this.store) || pen.visible == false) {
7251
7254
  continue;
7252
7255
  }
7253
- if (pen.name === 'combine' && !pen.draw) {
7254
- continue;
7255
- }
7256
+ // if (pen.name === 'combine' && !pen.draw){
7257
+ // continue;
7258
+ // }
7256
7259
  // TODO: hover 待考虑,若出现再补上
7257
7260
  const { active } = pen.calculative;
7258
7261
  pen.calculative.active = false;
@@ -7307,7 +7310,7 @@ export class Canvas {
7307
7310
  const ctx = canvas.getContext('2d');
7308
7311
  ctx.textBaseline = 'middle'; // 默认垂直居中
7309
7312
  ctx.scale(scale, scale);
7310
- const background = this.store.data.background || this.store.styles.background;
7313
+ const background = this.store.options.downloadBgTransparent ? undefined : (this.store.data.background || this.store.styles.background);
7311
7314
  // this.store.data.background || this.store.options.background;
7312
7315
  if (background) {
7313
7316
  // 绘制背景颜色
@@ -7324,9 +7327,9 @@ export class Canvas {
7324
7327
  if (!isShowChild(pen, this.store) || pen.visible == false) {
7325
7328
  continue;
7326
7329
  }
7327
- if (pen.name === 'combine' && !pen.draw) {
7328
- continue;
7329
- }
7330
+ // if (pen.name === 'combine' && !pen.draw){
7331
+ // continue;
7332
+ // }
7330
7333
  const { active } = pen.calculative;
7331
7334
  pen.calculative.active = false;
7332
7335
  if (pen.calculative.img) {