@meta2d/core 1.0.84-alpha.1 → 1.0.85

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.85",
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
  }
@@ -4094,6 +4097,9 @@ export class Canvas {
4094
4097
  }, 50);
4095
4098
  }
4096
4099
  initGlobalStyle() {
4100
+ if (this.store.options.themeOnlyCanvas || this.store.data.themeOnlyCanvas) {
4101
+ return;
4102
+ }
4097
4103
  const options = {};
4098
4104
  const data = {};
4099
4105
  const theme = {};
@@ -4177,9 +4183,9 @@ export class Canvas {
4177
4183
  if (pen.canvasLayer === CanvasLayer.CanvasTemplate) {
4178
4184
  continue;
4179
4185
  }
4180
- if (pen.name === 'combine' && !pen.draw) {
4181
- continue;
4182
- }
4186
+ // if (pen.name === 'combine' && !pen.draw){
4187
+ // continue;
4188
+ // }
4183
4189
  if (pen.calculative.inView) {
4184
4190
  if (pen.canvasLayer === CanvasLayer.CanvasMain &&
4185
4191
  pen.name !== 'gif' &&
@@ -4211,9 +4217,9 @@ export class Canvas {
4211
4217
  };
4212
4218
  renderPenContainChild = (ctx, pen) => {
4213
4219
  if (pen.calculative.inView) {
4214
- if (!(pen.name === 'combine' && !pen.draw)) {
4215
- renderPen(ctx, pen); // 可见才绘制,组合为状态只显示其中一个
4216
- }
4220
+ // if (!(pen.name === 'combine' && !pen.draw)){
4221
+ renderPen(ctx, pen); // 可见才绘制,组合为状态只显示其中一个
4222
+ // }
4217
4223
  }
4218
4224
  pen.children?.forEach((id) => {
4219
4225
  const child = this.store.pens[id];
@@ -6954,7 +6960,7 @@ export class Canvas {
6954
6960
  if (needCalcIconRectProps.includes(k)) {
6955
6961
  willCalcIconRect = true;
6956
6962
  }
6957
- if (pen.image && pen.name !== 'gif' && ['globalAlpha', 'flipY', 'flipX', 'x', 'y', 'width', 'height', 'iconWidth', 'iconHeight', 'imageRatio', 'iconLeft', 'iconTop', 'iconAlign', 'rotate', 'visible'].includes(k)) {
6963
+ if (pen.image && pen.name !== 'gif' && needImgCanvasPatchFlagsProps.includes(k)) {
6958
6964
  willRenderImage = true;
6959
6965
  }
6960
6966
  }
@@ -7193,7 +7199,7 @@ export class Canvas {
7193
7199
  // }
7194
7200
  ctx.textBaseline = 'middle'; // 默认垂直居中
7195
7201
  ctx.scale(scale, scale);
7196
- const background = this.store.data.background || this.store.styles.background;
7202
+ const background = this.store.options.downloadBgTransparent ? undefined : (this.store.data.background || this.store.styles.background);
7197
7203
  // this.store.data.background || this.store.options.background;
7198
7204
  if (background && isV) {
7199
7205
  // 绘制背景颜色
@@ -7250,9 +7256,9 @@ export class Canvas {
7250
7256
  if (!isShowChild(pen, this.store) || pen.visible == false) {
7251
7257
  continue;
7252
7258
  }
7253
- if (pen.name === 'combine' && !pen.draw) {
7254
- continue;
7255
- }
7259
+ // if (pen.name === 'combine' && !pen.draw){
7260
+ // continue;
7261
+ // }
7256
7262
  // TODO: hover 待考虑,若出现再补上
7257
7263
  const { active } = pen.calculative;
7258
7264
  pen.calculative.active = false;
@@ -7307,7 +7313,7 @@ export class Canvas {
7307
7313
  const ctx = canvas.getContext('2d');
7308
7314
  ctx.textBaseline = 'middle'; // 默认垂直居中
7309
7315
  ctx.scale(scale, scale);
7310
- const background = this.store.data.background || this.store.styles.background;
7316
+ const background = this.store.options.downloadBgTransparent ? undefined : (this.store.data.background || this.store.styles.background);
7311
7317
  // this.store.data.background || this.store.options.background;
7312
7318
  if (background) {
7313
7319
  // 绘制背景颜色
@@ -7324,9 +7330,9 @@ export class Canvas {
7324
7330
  if (!isShowChild(pen, this.store) || pen.visible == false) {
7325
7331
  continue;
7326
7332
  }
7327
- if (pen.name === 'combine' && !pen.draw) {
7328
- continue;
7329
- }
7333
+ // if (pen.name === 'combine' && !pen.draw){
7334
+ // continue;
7335
+ // }
7330
7336
  const { active } = pen.calculative;
7331
7337
  pen.calculative.active = false;
7332
7338
  if (pen.calculative.img) {