@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 +1 -1
- package/src/canvas/canvas.js +21 -11
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.d.ts +12 -0
- package/src/core.js +117 -15
- package/src/core.js.map +1 -1
- package/src/pen/render.d.ts +6 -0
- package/src/pen/render.js +18 -0
- package/src/pen/render.js.map +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.js
CHANGED
|
@@ -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 &&
|
|
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
|
|
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
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
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 =
|
|
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) {
|