@meta2d/core 1.0.23 → 1.0.24

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.23",
3
+ "version": "1.0.24",
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",
@@ -36,4 +36,4 @@
36
36
  "access": "public"
37
37
  },
38
38
  "gitHead": "78f2a53ca1839c89b56e2e498d17ba4eb987ad14"
39
- }
39
+ }
@@ -82,7 +82,7 @@ var __values = (this && this.__values) || function(o) {
82
82
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
83
83
  };
84
84
  import { KeydownType } from '../options';
85
- 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, getGlobalColor, clearLifeCycle, rotatePen, } from '../pen';
85
+ 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, getGlobalColor, clearLifeCycle, rotatePen, calcTextAutoWidth, } from '../pen';
86
86
  import { calcRotate, distance, getDistance, hitPoint, PointType, PrevNextType, rotatePoint, samePoint, scalePoint, translatePoint, TwoWay, } from '../point';
87
87
  import { calcCenter, calcRightBottom, calcRelativePoint, getRect, getRectOfPoints, pointInRect, pointInSimpleRect, rectInRect, rectToPoints, resizeRect, translateRect, } from '../rect';
88
88
  import { EditType, globalStore, } from '../store';
@@ -307,6 +307,9 @@ var Canvas = /** @class */ (function () {
307
307
  e.target.tagName === 'TEXTAREA') {
308
308
  return;
309
309
  }
310
+ if (_this.store.options.unavailableKeys.includes(e.key)) {
311
+ return;
312
+ }
310
313
  var x = 10;
311
314
  var y = 10;
312
315
  switch (e.key) {
@@ -989,7 +992,7 @@ var Canvas = /** @class */ (function () {
989
992
  _this.store.data.rule &&
990
993
  !_this.store.options.disableRuleLine &&
991
994
  _this.addRuleLine(e);
992
- // this.inactive();
995
+ _this.inactive();
993
996
  break;
994
997
  case HoverType.Node:
995
998
  case HoverType.Line:
@@ -1662,7 +1665,7 @@ var Canvas = /** @class */ (function () {
1662
1665
  for (var _d = (e_1 = void 0, __values(pen.calculative.worldAnchors)), _e = _d.next(); !_e.done; _e = _d.next()) {
1663
1666
  var anchor = _e.value;
1664
1667
  if (hitPoint(pt, anchor, _this.pointSize, anchor.penId ? _this.store.pens[anchor.penId] : undefined)) {
1665
- _this.title.show(anchor);
1668
+ _this.title.show(anchor, pen);
1666
1669
  if (anchor.title) {
1667
1670
  return "break-outer";
1668
1671
  }
@@ -2237,7 +2240,7 @@ var Canvas = /** @class */ (function () {
2237
2240
  };
2238
2241
  this.ondblclick = function (e) {
2239
2242
  if (_this.store.hover &&
2240
- !_this.store.data.locked &&
2243
+ (!_this.store.data.locked || _this.store.hover.dbInput) &&
2241
2244
  !_this.store.options.disableInput) {
2242
2245
  if (_this.store.hover.onShowInput) {
2243
2246
  _this.store.hover.onShowInput(_this.store.hover, e);
@@ -2273,9 +2276,13 @@ var Canvas = /** @class */ (function () {
2273
2276
  return;
2274
2277
  }
2275
2278
  //过滤table2图元
2276
- if (!rect) {
2279
+ if (!rect && !pen.dbInput) {
2277
2280
  _this.setInputStyle(pen);
2278
2281
  }
2282
+ else {
2283
+ _this.inputDiv.style.width = '100%';
2284
+ _this.inputDiv.style.height = '100%';
2285
+ }
2279
2286
  var textRect = rect || pen.calculative.worldTextRect;
2280
2287
  //value和innerText问题
2281
2288
  var preInputText = pen.calculative.tempText || pen.text + '' || '';
@@ -2500,6 +2507,9 @@ var Canvas = /** @class */ (function () {
2500
2507
  pen.text = _this.inputDiv.dataset.value;
2501
2508
  pen.calculative.text = pen.text;
2502
2509
  _this.inputDiv.dataset.penId = undefined;
2510
+ if (pen.name === 'text' && pen.textAutoAdjust) {
2511
+ calcTextAutoWidth(pen);
2512
+ }
2503
2513
  calcTextRect(pen);
2504
2514
  _this.patchFlags = true;
2505
2515
  _this.pushHistory({
@@ -3148,7 +3158,6 @@ var Canvas = /** @class */ (function () {
3148
3158
  },
3149
3159
  ],
3150
3160
  });
3151
- this.inactive();
3152
3161
  };
3153
3162
  /**
3154
3163
  * 拖拽结束,数据更新到 active.pens
@@ -3189,6 +3198,9 @@ var Canvas = /** @class */ (function () {
3189
3198
  // active 消息表示拖拽结束
3190
3199
  // this.store.emitter.emit('active', this.store.active);
3191
3200
  this.initImageCanvas(this.store.active);
3201
+ // 避免选中图元的出错情况,this.dock为undefined
3202
+ if (!this.dock)
3203
+ return;
3192
3204
  var _a = this.dock, xDock = _a.xDock, yDock = _a.yDock;
3193
3205
  var dockPen;
3194
3206
  if (xDock) {
@@ -4625,7 +4637,8 @@ var Canvas = /** @class */ (function () {
4625
4637
  // 线宽为 0 ,看不到外边框,拖动过程中给个外边框
4626
4638
  pen.lineWidth === 0 && (value.lineWidth = 1);
4627
4639
  // TODO: 例如 pen.name = 'triangle' 的情况,但有图片,是否还需要变成矩形呢?
4628
- if (isDomShapes.includes(pen.name) ||
4640
+ if (pen.name.endsWith('Dom') ||
4641
+ isDomShapes.includes(pen.name) ||
4629
4642
  _this.store.options.domShapes.includes(pen.name) ||
4630
4643
  pen.image) {
4631
4644
  // 修改名称会执行 onDestroy ,清空它