@meta2d/core 1.0.73 → 1.0.75
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 +39 -4
- 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 +15 -0
- package/src/core.js +235 -37
- 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/pen/render.js +2 -3
- package/src/pen/render.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.shiftKey) {
|
|
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;
|
|
@@ -4090,7 +4105,9 @@ export class Canvas {
|
|
|
4090
4105
|
this.renderBorder();
|
|
4091
4106
|
this.renderHoverPoint();
|
|
4092
4107
|
offscreenCtx.restore();
|
|
4093
|
-
this.magnifierCanvas.
|
|
4108
|
+
if (this.magnifierCanvas.magnifier) {
|
|
4109
|
+
this.magnifierCanvas.render();
|
|
4110
|
+
}
|
|
4094
4111
|
const ctx = this.canvas.getContext('2d');
|
|
4095
4112
|
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
4096
4113
|
ctx.drawImage(this.offscreen, 0, 0, this.width, this.height);
|
|
@@ -6176,6 +6193,24 @@ export class Canvas {
|
|
|
6176
6193
|
this.store.pens[id].calculative.active = false;
|
|
6177
6194
|
this.store.pens[id].calculative.hover = false;
|
|
6178
6195
|
});
|
|
6196
|
+
if (this.store.hover.parentId) {
|
|
6197
|
+
//组合图元 找命中率高的子图元
|
|
6198
|
+
let id = this.store.hover.id;
|
|
6199
|
+
const pt = this.calibrateMouse({ x: e.offsetX, y: e.offsetY });
|
|
6200
|
+
let distance = Infinity;
|
|
6201
|
+
this.store.pens[this.store.hover.parentId]?.children?.forEach((_id) => {
|
|
6202
|
+
const pen = this.store.pens[_id];
|
|
6203
|
+
if (pointInRect(pt, pen.calculative.worldRect)) {
|
|
6204
|
+
const dis = Math.sqrt((pt.x - pen.calculative.worldRect.center.x) ** 2 + (pt.y - pen.calculative.worldRect.center.y) ** 2);
|
|
6205
|
+
if (dis < distance) {
|
|
6206
|
+
distance = dis;
|
|
6207
|
+
id = _id;
|
|
6208
|
+
}
|
|
6209
|
+
}
|
|
6210
|
+
});
|
|
6211
|
+
this.store.hover = this.store.pens[id];
|
|
6212
|
+
this.store.pens[id].calculative.hover = true;
|
|
6213
|
+
}
|
|
6179
6214
|
this.active([this.store.hover]);
|
|
6180
6215
|
}
|
|
6181
6216
|
}
|
|
@@ -7432,7 +7467,7 @@ export class Canvas {
|
|
|
7432
7467
|
//将所有当前框选的图元设置到该容器中
|
|
7433
7468
|
const pens = this.store.data.pens.filter((pen) => {
|
|
7434
7469
|
if (
|
|
7435
|
-
// pen.locked >= LockState.DisableMove ||
|
|
7470
|
+
// pen.locked >= LockState.DisableMove ||
|
|
7436
7471
|
pen.parentId || pen.isRuleLine) {
|
|
7437
7472
|
return false;
|
|
7438
7473
|
}
|
|
@@ -7581,7 +7616,7 @@ export class Canvas {
|
|
|
7581
7616
|
calcRightBottom(rect);
|
|
7582
7617
|
const pens = this.store.data.pens.filter((pen) => {
|
|
7583
7618
|
if (
|
|
7584
|
-
// pen.locked >= LockState.DisableMove ||
|
|
7619
|
+
// pen.locked >= LockState.DisableMove ||
|
|
7585
7620
|
pen.parentId || pen.isRuleLine) {
|
|
7586
7621
|
return false;
|
|
7587
7622
|
}
|