@meta2d/core 1.1.10 → 1.1.12

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.1.10",
3
+ "version": "1.1.12",
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",
@@ -1148,6 +1148,11 @@ export class Canvas {
1148
1148
  };
1149
1149
  async dropPens(pens, e) {
1150
1150
  this.randomIdObj = {};
1151
+ if (this.parent.store.options.textPresetStyle) {
1152
+ if (pens.length === 1 && !pens[0].temPreset && pens[0].name === 'text') {
1153
+ Object.assign(pens[0], this.parent.store.options.textPresetStyle);
1154
+ }
1155
+ }
1151
1156
  for (const pen of pens) {
1152
1157
  // 只修改 树根处的 祖先节点, randomCombineId 会递归更改子节点
1153
1158
  !pen.parentId && this.randomCombineId(pen, pens);
@@ -1617,8 +1622,8 @@ export class Canvas {
1617
1622
  canvas: this,
1618
1623
  active: true,
1619
1624
  worldAnchors: [pt],
1620
- lineWidth: lineWidth * scale,
1621
- ...options.linePresetStyle
1625
+ ...options.linePresetStyle,
1626
+ lineWidth: options.linePresetStyle.lineWidth ? options.linePresetStyle.lineWidth * scale : lineWidth * scale
1622
1627
  },
1623
1628
  fromArrow: data.fromArrow || options.fromArrow,
1624
1629
  toArrow: data.toArrow || options.toArrow,
@@ -5233,7 +5238,7 @@ export class Canvas {
5233
5238
  if (pen.name.endsWith('Dom') ||
5234
5239
  isDomShapes.includes(pen.name) ||
5235
5240
  this.store.options.domShapes.includes(pen.name) ||
5236
- pen.image) {
5241
+ pen.image || pen.isDom) {
5237
5242
  // 修改名称会执行 onDestroy ,清空它
5238
5243
  value.name = 'rectangle';
5239
5244
  value.onDestroy = undefined;
@@ -7065,6 +7070,12 @@ export class Canvas {
7065
7070
  e.stopPropagation();
7066
7071
  };
7067
7072
  this.inputDiv.onkeydown = (e) => {
7073
+ if (e.key === 'Enter') {
7074
+ const pen = this.store.pens[this.inputDiv.dataset.penId];
7075
+ if (pen.input && pen.whiteSpace === 'nowrap') {
7076
+ this.hideInput();
7077
+ }
7078
+ }
7068
7079
  e.stopPropagation();
7069
7080
  };
7070
7081
  this.inputDiv.onmousedown = this.stopPropagation;