@meta2d/core 1.0.30 → 1.0.32
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 +2 -2
- package/src/canvas/canvas.js +19 -2
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.d.ts +7 -2
- package/src/core.js +78 -20
- package/src/core.js.map +1 -1
- package/src/diagrams/line/polyline.js +19 -0
- package/src/diagrams/line/polyline.js.map +1 -1
- package/src/pen/render.js +3 -1
- package/src/pen/render.js.map +1 -1
- package/src/scroll/scroll.js +2 -0
- package/src/scroll/scroll.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meta2d/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
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
|
+
}
|
package/src/canvas/canvas.js
CHANGED
|
@@ -273,6 +273,13 @@ var Canvas = /** @class */ (function () {
|
|
|
273
273
|
_this.translate(-e.deltaX, -e.deltaY);
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
|
+
if (Math.abs(e.wheelDelta) > 100) {
|
|
277
|
+
//鼠标滚轮滚动 scroll模式下是上下滚动而不是缩放
|
|
278
|
+
if (_this.store.options.scroll && _this.scroll) {
|
|
279
|
+
_this.scroll.wheel(e.deltaY < 0);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
276
283
|
//禁止触摸屏双指缩放操作
|
|
277
284
|
if (_this.store.options.disableTouchPadScale) {
|
|
278
285
|
return;
|
|
@@ -638,9 +645,11 @@ var Canvas = /** @class */ (function () {
|
|
|
638
645
|
}
|
|
639
646
|
}
|
|
640
647
|
catch (e) { }
|
|
641
|
-
if (
|
|
648
|
+
if (!!obj) return [3 /*break*/, 3];
|
|
642
649
|
files = event.dataTransfer.files;
|
|
643
|
-
if (!(files.length &&
|
|
650
|
+
if (!(files.length &&
|
|
651
|
+
files[0].type.match('image.*') &&
|
|
652
|
+
!(this.addCaches && this.addCaches.length))) return [3 /*break*/, 2];
|
|
644
653
|
isGif = files[0].type === 'image/gif';
|
|
645
654
|
return [4 /*yield*/, this.fileToPen(files[0], isGif)];
|
|
646
655
|
case 1:
|
|
@@ -1745,6 +1754,7 @@ var Canvas = /** @class */ (function () {
|
|
|
1745
1754
|
_this.store.hover = pen;
|
|
1746
1755
|
_this.store.pointAt = pos.point;
|
|
1747
1756
|
_this.store.pointAtIndex = pos.i;
|
|
1757
|
+
_this.initTemplateCanvas([_this.store.hover]);
|
|
1748
1758
|
hoverType = HoverType.Line;
|
|
1749
1759
|
return "break";
|
|
1750
1760
|
}
|
|
@@ -1780,6 +1790,7 @@ var Canvas = /** @class */ (function () {
|
|
|
1780
1790
|
_this.externalElements.style.cursor = _this.store.options.hoverCursor;
|
|
1781
1791
|
}
|
|
1782
1792
|
_this.store.hover = pen;
|
|
1793
|
+
_this.initTemplateCanvas([_this.store.hover]);
|
|
1783
1794
|
hoverType = HoverType.Node;
|
|
1784
1795
|
_this.store.pointAt = pt;
|
|
1785
1796
|
// 锚点贴边吸附
|
|
@@ -3001,6 +3012,7 @@ var Canvas = /** @class */ (function () {
|
|
|
3001
3012
|
{ x: pen.x + pen.width, y: pen.y },
|
|
3002
3013
|
{ x: pen.x, y: pen.y + pen.height },
|
|
3003
3014
|
{ x: pen.x + pen.width, y: pen.y + pen.height },
|
|
3015
|
+
{ x: pen.x + pen.width / 2, y: pen.y + pen.height / 2 },
|
|
3004
3016
|
];
|
|
3005
3017
|
if ((pen.x === rect_1.x &&
|
|
3006
3018
|
pen.y === rect_1.y &&
|
|
@@ -3359,6 +3371,7 @@ var Canvas = /** @class */ (function () {
|
|
|
3359
3371
|
if (!this.store.active.length) {
|
|
3360
3372
|
return;
|
|
3361
3373
|
}
|
|
3374
|
+
this.initTemplateCanvas(this.store.active);
|
|
3362
3375
|
this.store.active.forEach(function (pen) {
|
|
3363
3376
|
pen.calculative.active = undefined;
|
|
3364
3377
|
pen.calculative.activeAnchor = undefined;
|
|
@@ -3401,6 +3414,7 @@ var Canvas = /** @class */ (function () {
|
|
|
3401
3414
|
(_b = this.store.active).push.apply(_b, __spreadArray([], __read(pens), false));
|
|
3402
3415
|
this.activeRect = undefined;
|
|
3403
3416
|
this.calcActiveRect();
|
|
3417
|
+
this.initTemplateCanvas(pens);
|
|
3404
3418
|
this.patchFlags = true;
|
|
3405
3419
|
emit && this.store.emitter.emit('active', this.store.active);
|
|
3406
3420
|
};
|
|
@@ -5200,6 +5214,9 @@ var Canvas = /** @class */ (function () {
|
|
|
5200
5214
|
var from = getFromAnchor(line);
|
|
5201
5215
|
var to = getToAnchor(line);
|
|
5202
5216
|
var newAnchor = nearestAnchor(pen, lineAnchor === from ? to : from);
|
|
5217
|
+
if (!newAnchor) {
|
|
5218
|
+
return;
|
|
5219
|
+
}
|
|
5203
5220
|
lineAnchor.x = newAnchor.x;
|
|
5204
5221
|
lineAnchor.y = newAnchor.y;
|
|
5205
5222
|
lineAnchor.prev = undefined;
|