@meta2d/core 1.0.88 → 1.0.90

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.88",
3
+ "version": "1.0.90",
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",
@@ -15,6 +15,7 @@ import { MagnifierCanvas } from './magnifierCanvas';
15
15
  import { lockedError } from '../utils/error';
16
16
  import { Dialog } from '../dialog';
17
17
  import { setter } from '../utils/object';
18
+ import { isNumber } from '../utils/tool';
18
19
  import { Title } from '../title';
19
20
  import { CanvasTemplate } from './canvasTemplate';
20
21
  import { getLinePoints } from '../diagrams/line';
@@ -4037,31 +4038,51 @@ export class Canvas {
4037
4038
  pen.calculative.fontSize =
4038
4039
  pen.fontSize * pen.calculative.worldRect.height;
4039
4040
  }
4040
- pen.calculative.iconSize = pen.iconSize * scale;
4041
- pen.calculative.iconWidth = pen.iconWidth * scale;
4042
- pen.calculative.iconHeight = pen.iconHeight * scale;
4043
- pen.calculative.iconLeft =
4044
- pen.iconLeft < 1 && pen.iconLeft > -1
4045
- ? pen.iconLeft
4046
- : pen.iconLeft * scale;
4047
- pen.calculative.iconTop =
4048
- pen.iconTop < 1 && pen.iconTop > -1 ? pen.iconTop : pen.iconTop * scale;
4049
- pen.calculative.textWidth =
4050
- pen.textWidth < 1 && pen.textWidth > -1
4051
- ? pen.textWidth
4052
- : pen.textWidth * scale;
4053
- pen.calculative.textHeight =
4054
- pen.textHeight < 1 && pen.textHeight > -1
4055
- ? pen.textHeight
4056
- : pen.textHeight * scale;
4057
- pen.calculative.textLeft =
4058
- pen.textLeft < 1 && pen.textLeft > -1
4059
- ? pen.textLeft * pen.calculative.worldRect.width
4060
- : pen.textLeft * scale;
4061
- pen.calculative.textTop =
4062
- pen.textTop < 1 && pen.textTop > -1 ? pen.textTop * pen.calculative.worldRect.height : pen.textTop * scale;
4063
- if (pen.type === PenType.Line && pen.borderWidth) {
4064
- pen.calculative.borderWidth = pen.borderWidth * scale;
4041
+ if (isNumber(pen.iconSize)) {
4042
+ pen.calculative.iconSize = pen.iconSize * scale;
4043
+ }
4044
+ if (isNumber(pen.iconWidth)) {
4045
+ pen.calculative.iconWidth = pen.iconWidth * scale;
4046
+ }
4047
+ if (isNumber(pen.iconHeight)) {
4048
+ pen.calculative.iconHeight = pen.iconHeight * scale;
4049
+ }
4050
+ if (isNumber(pen.iconLeft)) {
4051
+ pen.calculative.iconLeft =
4052
+ pen.iconLeft < 1 && pen.iconLeft > -1
4053
+ ? pen.iconLeft
4054
+ : pen.iconLeft * scale;
4055
+ }
4056
+ if (isNumber(pen.iconTop)) {
4057
+ pen.calculative.iconTop =
4058
+ pen.iconTop < 1 && pen.iconTop > -1 ? pen.iconTop : pen.iconTop * scale;
4059
+ }
4060
+ if (isNumber(pen.textWidth)) {
4061
+ pen.calculative.textWidth =
4062
+ pen.textWidth < 1 && pen.textWidth > -1
4063
+ ? pen.textWidth
4064
+ : pen.textWidth * scale;
4065
+ }
4066
+ if (isNumber(pen.textHeight)) {
4067
+ pen.calculative.textHeight =
4068
+ pen.textHeight < 1 && pen.textHeight > -1
4069
+ ? pen.textHeight
4070
+ : pen.textHeight * scale;
4071
+ }
4072
+ if (isNumber(pen.textLeft)) {
4073
+ pen.calculative.textLeft =
4074
+ pen.textLeft < 1 && pen.textLeft > -1
4075
+ ? pen.textLeft * pen.calculative.worldRect.width
4076
+ : pen.textLeft * scale;
4077
+ }
4078
+ if (isNumber(pen.textTop)) {
4079
+ pen.calculative.textTop =
4080
+ pen.textTop < 1 && pen.textTop > -1 ? pen.textTop * pen.calculative.worldRect.height : pen.textTop * scale;
4081
+ }
4082
+ if (isNumber(pen.borderWidth)) {
4083
+ if (pen.type === PenType.Line && pen.borderWidth) {
4084
+ pen.calculative.borderWidth = pen.borderWidth * scale;
4085
+ }
4065
4086
  }
4066
4087
  }
4067
4088
  updatePenRect(pen, { worldRectIsReady, playingAnimate, } = {}) {
@@ -6596,7 +6617,7 @@ export class Canvas {
6596
6617
  this.store.emitter.emit('change', pen);
6597
6618
  this.store.emitter.emit('valueUpdate', pen);
6598
6619
  }
6599
- else if (pen.text === this.inputDiv.dataset.value && pen.calculative.textLines.length == 0) {
6620
+ else if (pen.text === this.inputDiv.dataset.value && pen.calculative.textLines && pen.calculative.textLines.length == 0) {
6600
6621
  calcTextRect(pen);
6601
6622
  }
6602
6623
  this.initTemplateCanvas([pen]);
@@ -7018,7 +7039,7 @@ export class Canvas {
7018
7039
  this.updatePenRect(pen);
7019
7040
  }
7020
7041
  else {
7021
- willCalcTextRect && calcTextRect(pen);
7042
+ !pen.hiddenText && willCalcTextRect && calcTextRect(pen);
7022
7043
  willCalcIconRect && calcIconRect(this.store.pens, pen);
7023
7044
  if (willUpdatePath) {
7024
7045
  globalStore.path2dDraws[pen.name] &&