@meta2d/core 1.0.73 → 1.0.74
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 +36 -3
- package/src/canvas/canvas.js.map +1 -1
- package/src/canvas/canvasImage.js +1 -1
- package/src/canvas/canvasImage.js.map +1 -1
- package/src/core.d.ts +12 -0
- package/src/core.js +102 -0
- package/src/core.js.map +1 -1
- package/src/diagrams/cube.js +1 -1
- package/src/diagrams/cube.js.map +1 -1
- package/src/event/event.d.ts +8 -0
- package/src/event/event.js.map +1 -1
- package/src/store/store.d.ts +1 -0
- package/src/store/store.js.map +1 -1
- package/src/theme.d.ts +1 -0
- package/src/theme.js +3 -0
- package/src/theme.js.map +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.js
CHANGED
|
@@ -362,7 +362,9 @@ export class Canvas {
|
|
|
362
362
|
onMessage = (e) => {
|
|
363
363
|
if (typeof e.data !== 'string' ||
|
|
364
364
|
!e.data ||
|
|
365
|
-
e.data.startsWith('setImmediate')
|
|
365
|
+
e.data.startsWith('setImmediate') ||
|
|
366
|
+
e.data.startsWith('webpackHotUpdate') // 处理vue2 webpack4 热更新消息冲突问题
|
|
367
|
+
) {
|
|
366
368
|
return;
|
|
367
369
|
}
|
|
368
370
|
let data = JSON.parse(e.data);
|
|
@@ -729,6 +731,19 @@ export class Canvas {
|
|
|
729
731
|
break;
|
|
730
732
|
case 'g':
|
|
731
733
|
case 'G':
|
|
734
|
+
//组合/解组
|
|
735
|
+
if (e.ctrlKey || e.metaKey) {
|
|
736
|
+
if (e.altKey) {
|
|
737
|
+
this.parent.uncombine();
|
|
738
|
+
}
|
|
739
|
+
else {
|
|
740
|
+
if (this.store.active.length > 1) {
|
|
741
|
+
this.parent.combine(this.store.active);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
e.preventDefault();
|
|
745
|
+
break;
|
|
746
|
+
}
|
|
732
747
|
// 进入移动瞄点状态
|
|
733
748
|
if (this.hoverType === HoverType.NodeAnchor) {
|
|
734
749
|
this.movingAnchor = this.store.hoverAnchor;
|
|
@@ -6176,6 +6191,24 @@ export class Canvas {
|
|
|
6176
6191
|
this.store.pens[id].calculative.active = false;
|
|
6177
6192
|
this.store.pens[id].calculative.hover = false;
|
|
6178
6193
|
});
|
|
6194
|
+
if (this.store.hover.parentId) {
|
|
6195
|
+
//组合图元 找命中率高的子图元
|
|
6196
|
+
let id = this.store.hover.id;
|
|
6197
|
+
const pt = this.calibrateMouse({ x: e.offsetX, y: e.offsetY });
|
|
6198
|
+
let distance = Infinity;
|
|
6199
|
+
this.store.pens[this.store.hover.parentId]?.children?.forEach((_id) => {
|
|
6200
|
+
const pen = this.store.pens[_id];
|
|
6201
|
+
if (pointInRect(pt, pen.calculative.worldRect)) {
|
|
6202
|
+
const dis = Math.sqrt((pt.x - pen.calculative.worldRect.center.x) ** 2 + (pt.y - pen.calculative.worldRect.center.y) ** 2);
|
|
6203
|
+
if (dis < distance) {
|
|
6204
|
+
distance = dis;
|
|
6205
|
+
id = _id;
|
|
6206
|
+
}
|
|
6207
|
+
}
|
|
6208
|
+
});
|
|
6209
|
+
this.store.hover = this.store.pens[id];
|
|
6210
|
+
this.store.pens[id].calculative.hover = true;
|
|
6211
|
+
}
|
|
6179
6212
|
this.active([this.store.hover]);
|
|
6180
6213
|
}
|
|
6181
6214
|
}
|
|
@@ -7432,7 +7465,7 @@ export class Canvas {
|
|
|
7432
7465
|
//将所有当前框选的图元设置到该容器中
|
|
7433
7466
|
const pens = this.store.data.pens.filter((pen) => {
|
|
7434
7467
|
if (
|
|
7435
|
-
// pen.locked >= LockState.DisableMove ||
|
|
7468
|
+
// pen.locked >= LockState.DisableMove ||
|
|
7436
7469
|
pen.parentId || pen.isRuleLine) {
|
|
7437
7470
|
return false;
|
|
7438
7471
|
}
|
|
@@ -7581,7 +7614,7 @@ export class Canvas {
|
|
|
7581
7614
|
calcRightBottom(rect);
|
|
7582
7615
|
const pens = this.store.data.pens.filter((pen) => {
|
|
7583
7616
|
if (
|
|
7584
|
-
// pen.locked >= LockState.DisableMove ||
|
|
7617
|
+
// pen.locked >= LockState.DisableMove ||
|
|
7585
7618
|
pen.parentId || pen.isRuleLine) {
|
|
7586
7619
|
return false;
|
|
7587
7620
|
}
|