@meta2d/core 1.0.8 → 1.0.9

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.8",
3
+ "version": "1.0.9",
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",
@@ -337,7 +337,7 @@ var Canvas = /** @class */ (function () {
337
337
  }
338
338
  break;
339
339
  case 'Alt':
340
- if (_this.drawingLine) {
340
+ if (!e.ctrlKey && !e.shiftKey && _this.drawingLine) {
341
341
  var to = getToAnchor(_this.drawingLine);
342
342
  if (to !== _this.drawingLine.calculative.activeAnchor) {
343
343
  deleteTempAnchor(_this.drawingLine);
@@ -812,10 +812,13 @@ var Canvas = /** @class */ (function () {
812
812
  }
813
813
  //shift 快捷添加锚点并连线
814
814
  if (!_this.store.options.autoAnchor && !_this.drawingLine) {
815
- if (e.shiftKey && !e.ctrlKey) {
815
+ if (e.shiftKey && e.ctrlKey && e.altKey) {
816
816
  _this.setAnchor(_this.store.pointAt);
817
817
  _this.drawingLineName = _this.store.options.drawingLineName;
818
818
  var anchor = _this.store.activeAnchor;
819
+ if (!anchor) {
820
+ return;
821
+ }
819
822
  var pt = {
820
823
  id: s8(),
821
824
  x: anchor.x,
@@ -849,10 +852,13 @@ var Canvas = /** @class */ (function () {
849
852
  }
850
853
  //shift快捷添加锚点并完成连线
851
854
  if (!_this.store.options.autoAnchor) {
852
- if (e.shiftKey) {
855
+ if (e.shiftKey && e.altKey && e.ctrlKey) {
853
856
  _this.setAnchor(_this.store.pointAt);
854
857
  var to_2 = getToAnchor(_this.drawingLine);
855
858
  var anchor = _this.store.activeAnchor;
859
+ if (!anchor) {
860
+ return;
861
+ }
856
862
  to_2.x = anchor.x;
857
863
  to_2.y = anchor.y;
858
864
  connectLine(_this.store.hover, anchor, _this.drawingLine, to_2);
@@ -3615,6 +3621,7 @@ var Canvas = /** @class */ (function () {
3615
3621
  };
3616
3622
  Canvas.prototype.makePen = function (pen) {
3617
3623
  var _this = this;
3624
+ var _a;
3618
3625
  if (!pen.id) {
3619
3626
  pen.id = s8();
3620
3627
  }
@@ -3631,14 +3638,14 @@ var Canvas = /** @class */ (function () {
3631
3638
  if (pen.lineWidth == undefined) {
3632
3639
  pen.lineWidth = 1;
3633
3640
  }
3634
- var _a = this.store.options, fontSize = _a.fontSize, lineHeight = _a.lineHeight;
3641
+ var _b = this.store.options, fontSize = _b.fontSize, lineHeight = _b.lineHeight;
3635
3642
  if (!pen.fontSize) {
3636
3643
  pen.fontSize = fontSize;
3637
3644
  }
3638
3645
  if (!pen.lineHeight) {
3639
3646
  pen.lineHeight = lineHeight;
3640
3647
  }
3641
- pen.calculative = { canvas: this };
3648
+ pen.calculative = { canvas: this, singleton: (_a = pen.calculative) === null || _a === void 0 ? void 0 : _a.singleton };
3642
3649
  if (pen.video || pen.audio) {
3643
3650
  pen.calculative.onended = function (pen) {
3644
3651
  _this.nextAnimate(pen);
@@ -4641,11 +4648,13 @@ var Canvas = /** @class */ (function () {
4641
4648
  case 6:
4642
4649
  this.hotkeyType = HotkeyType.None;
4643
4650
  this.render();
4644
- this.pushHistory({
4645
- type: EditType.Update,
4646
- pens: [deepClone(hoverPen, true)],
4647
- initPens: initPens,
4648
- });
4651
+ if (hoverPen) {
4652
+ this.pushHistory({
4653
+ type: EditType.Update,
4654
+ pens: [deepClone(hoverPen, true)],
4655
+ initPens: initPens,
4656
+ });
4657
+ }
4649
4658
  return [2 /*return*/];
4650
4659
  }
4651
4660
  });
@@ -5434,6 +5443,7 @@ var Canvas = /** @class */ (function () {
5434
5443
  pens.forEach(function (pen) {
5435
5444
  if (!pen.parentId) {
5436
5445
  if (pen.locked) {
5446
+ // TODO: canDelLocked 是 true , locked 仍然删不掉
5437
5447
  return;
5438
5448
  }
5439
5449
  else {
@@ -5450,7 +5460,7 @@ var Canvas = /** @class */ (function () {
5450
5460
  return;
5451
5461
  }
5452
5462
  else {
5453
- var parentPen = _this.store.data.pens[pen.parentId];
5463
+ var parentPen = getParent(pen);
5454
5464
  var _index = parentPen.children.indexOf(pen.id);
5455
5465
  parentPen.children.splice(_index, 1);
5456
5466
  if (delPens) {