@meta2d/core 1.0.62 → 1.0.63
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.d.ts +4 -2
- package/src/canvas/canvas.js +28 -4
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.d.ts +9 -3
- package/src/core.js +182 -9
- package/src/core.js.map +1 -1
- package/src/event/event.d.ts +7 -1
- package/src/event/event.js +1 -0
- package/src/event/event.js.map +1 -1
- package/src/message/index.d.ts +1 -0
- package/src/message/index.js +2 -0
- package/src/message/index.js.map +1 -0
- package/src/message/message.d.ts +28 -0
- package/src/message/message.js +162 -0
- package/src/message/message.js.map +1 -0
- package/src/pen/model.d.ts +3 -0
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.js +1 -1
- package/src/pen/render.js.map +1 -1
- package/src/popconfirm/index.d.ts +1 -0
- package/src/popconfirm/index.js +2 -0
- package/src/popconfirm/index.js.map +1 -0
- package/src/popconfirm/popconfirm.d.ts +21 -0
- package/src/popconfirm/popconfirm.js +135 -0
- package/src/popconfirm/popconfirm.js.map +1 -0
- package/src/store/store.d.ts +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { Meta2d } from '../core';
|
|
|
14
14
|
import { Dialog } from '../dialog';
|
|
15
15
|
import { Title } from '../title';
|
|
16
16
|
import { CanvasTemplate } from './canvasTemplate';
|
|
17
|
+
import { Popconfirm } from '../popconfirm';
|
|
17
18
|
export declare const movingSuffix: "-moving";
|
|
18
19
|
export declare class Canvas {
|
|
19
20
|
parent: Meta2d;
|
|
@@ -108,6 +109,7 @@ export declare class Canvas {
|
|
|
108
109
|
inputDiv: HTMLDivElement;
|
|
109
110
|
dropdown: HTMLUListElement;
|
|
110
111
|
tooltip: Tooltip;
|
|
112
|
+
popconfirm: Popconfirm;
|
|
111
113
|
title: Title;
|
|
112
114
|
mousePos: Point;
|
|
113
115
|
scroll: Scroll;
|
|
@@ -143,7 +145,7 @@ export declare class Canvas {
|
|
|
143
145
|
ondrop: (event: DragEvent) => Promise<void>;
|
|
144
146
|
dropPens(pens: Pen[], e: Point): Promise<void>;
|
|
145
147
|
randomCombineId(pen: Pen, pens: Pen[], parentId?: string): Pen;
|
|
146
|
-
addPens(pens: Pen[], history?: boolean): Promise<Pen[]>;
|
|
148
|
+
addPens(pens: Pen[], history?: boolean, abs?: boolean): Promise<Pen[]>;
|
|
147
149
|
ontouchstart: (e: TouchEvent) => void;
|
|
148
150
|
ontouchmove: (event: TouchEvent) => void;
|
|
149
151
|
ontouchend: (event: TouchEvent) => void;
|
|
@@ -237,7 +239,7 @@ export declare class Canvas {
|
|
|
237
239
|
inAnchor(pt: Point, pen: Pen, anchor: Point): HoverType;
|
|
238
240
|
resize(w?: number, h?: number): void;
|
|
239
241
|
clearCanvas(): void;
|
|
240
|
-
addPen(pen: Pen, history?: boolean, emit?: boolean): Promise<Pen>;
|
|
242
|
+
addPen(pen: Pen, history?: boolean, emit?: boolean, abs?: boolean): Promise<Pen>;
|
|
241
243
|
pushHistory(action: EditAction): void;
|
|
242
244
|
undo(): void;
|
|
243
245
|
redo(): void;
|
package/src/canvas/canvas.js
CHANGED
|
@@ -18,6 +18,7 @@ import { setter } from '../utils/object';
|
|
|
18
18
|
import { Title } from '../title';
|
|
19
19
|
import { CanvasTemplate } from './canvasTemplate';
|
|
20
20
|
import { getLinePoints } from '../diagrams/line';
|
|
21
|
+
import { Popconfirm } from '../popconfirm';
|
|
21
22
|
export const movingSuffix = '-moving';
|
|
22
23
|
export class Canvas {
|
|
23
24
|
parent;
|
|
@@ -97,6 +98,7 @@ export class Canvas {
|
|
|
97
98
|
// inputRight = document.createElement('div');
|
|
98
99
|
dropdown = document.createElement('ul');
|
|
99
100
|
tooltip;
|
|
101
|
+
popconfirm;
|
|
100
102
|
title;
|
|
101
103
|
mousePos = { x: 0, y: 0 };
|
|
102
104
|
scroll;
|
|
@@ -143,6 +145,7 @@ export class Canvas {
|
|
|
143
145
|
let hover = this.store.data.pens.find((item) => item.calculative.hover === true);
|
|
144
146
|
setHover(hover, false);
|
|
145
147
|
};
|
|
148
|
+
this.popconfirm = new Popconfirm(parentElement, store);
|
|
146
149
|
this.dialog = new Dialog(parentElement);
|
|
147
150
|
this.title = new Title(parentElement);
|
|
148
151
|
if (this.store.options.scroll) {
|
|
@@ -1229,7 +1232,7 @@ export class Canvas {
|
|
|
1229
1232
|
pen.children = newChildren;
|
|
1230
1233
|
return pen;
|
|
1231
1234
|
}
|
|
1232
|
-
async addPens(pens, history) {
|
|
1235
|
+
async addPens(pens, history, abs) {
|
|
1233
1236
|
if (this.beforeAddPens && (await this.beforeAddPens(pens)) != true) {
|
|
1234
1237
|
return [];
|
|
1235
1238
|
}
|
|
@@ -1238,6 +1241,12 @@ export class Canvas {
|
|
|
1238
1241
|
if (this.beforeAddPen && this.beforeAddPen(pen) != true) {
|
|
1239
1242
|
continue;
|
|
1240
1243
|
}
|
|
1244
|
+
if (abs) {
|
|
1245
|
+
pen.x = pen.x * this.store.data.scale + this.store.data.origin.x;
|
|
1246
|
+
pen.y = pen.y * this.store.data.scale + this.store.data.origin.y;
|
|
1247
|
+
pen.width = pen.width * this.store.data.scale;
|
|
1248
|
+
pen.height = pen.height * this.store.data.scale;
|
|
1249
|
+
}
|
|
1241
1250
|
this.makePen(pen);
|
|
1242
1251
|
list.push(pen);
|
|
1243
1252
|
}
|
|
@@ -1462,6 +1471,7 @@ export class Canvas {
|
|
|
1462
1471
|
this.mouseRight = MouseRight.Down;
|
|
1463
1472
|
}
|
|
1464
1473
|
this.hideInput();
|
|
1474
|
+
this.popconfirm.hide();
|
|
1465
1475
|
if (this.store.data.locked === LockState.Disable ||
|
|
1466
1476
|
(e.buttons !== 1 && e.buttons !== 2)) {
|
|
1467
1477
|
this.hoverType = HoverType.None;
|
|
@@ -3210,13 +3220,19 @@ export class Canvas {
|
|
|
3210
3220
|
this.canvasImage.clear();
|
|
3211
3221
|
this.canvasImageBottom.clear();
|
|
3212
3222
|
}
|
|
3213
|
-
async addPen(pen, history, emit) {
|
|
3223
|
+
async addPen(pen, history, emit, abs) {
|
|
3214
3224
|
if (this.beforeAddPens && (await this.beforeAddPens([pen])) != true) {
|
|
3215
3225
|
return;
|
|
3216
3226
|
}
|
|
3217
3227
|
if (this.beforeAddPen && this.beforeAddPen(pen) != true) {
|
|
3218
3228
|
return;
|
|
3219
3229
|
}
|
|
3230
|
+
if (abs) {
|
|
3231
|
+
pen.x = pen.x * this.store.data.scale + this.store.data.origin.x;
|
|
3232
|
+
pen.y = pen.y * this.store.data.scale + this.store.data.origin.y;
|
|
3233
|
+
pen.width = pen.width * this.store.data.scale;
|
|
3234
|
+
pen.height = pen.height * this.store.data.scale;
|
|
3235
|
+
}
|
|
3220
3236
|
this.makePen(pen);
|
|
3221
3237
|
this.active([pen]);
|
|
3222
3238
|
this.render();
|
|
@@ -6715,7 +6731,12 @@ export class Canvas {
|
|
|
6715
6731
|
// 单属性
|
|
6716
6732
|
if (k.indexOf('.') === -1) {
|
|
6717
6733
|
if (k === 'rotate') {
|
|
6718
|
-
|
|
6734
|
+
if (pen.disableRotate) { //当图元禁止旋转时不重新设置旋转角度
|
|
6735
|
+
pen.rotate = pen.calculative.rotate || 0;
|
|
6736
|
+
}
|
|
6737
|
+
else {
|
|
6738
|
+
oldRotate = pen.calculative.rotate || 0;
|
|
6739
|
+
}
|
|
6719
6740
|
}
|
|
6720
6741
|
else if (k === 'canvasLayer' || k === 'isBottom' || k === 'showChild') {
|
|
6721
6742
|
containIsBottom = true;
|
|
@@ -6724,7 +6745,9 @@ export class Canvas {
|
|
|
6724
6745
|
willRenderImage = true;
|
|
6725
6746
|
}
|
|
6726
6747
|
if (typeof pen[k] !== 'object' || k === 'lineDash') {
|
|
6727
|
-
pen.
|
|
6748
|
+
if (!pen.disableRotate || k !== 'rotate') { //当图元禁止旋转时不重新设置旋转角度
|
|
6749
|
+
pen.calculative[k] = data[k];
|
|
6750
|
+
}
|
|
6728
6751
|
}
|
|
6729
6752
|
if (needCalcTextRectProps.includes(k)) {
|
|
6730
6753
|
willCalcTextRect = true;
|
|
@@ -7607,6 +7630,7 @@ export class Canvas {
|
|
|
7607
7630
|
this.tooltip?.destroy();
|
|
7608
7631
|
this.dialog?.destroy();
|
|
7609
7632
|
this.title?.destroy();
|
|
7633
|
+
this.popconfirm?.destroy();
|
|
7610
7634
|
// ios
|
|
7611
7635
|
this.externalElements.removeEventListener('gesturestart', this.onGesturestart);
|
|
7612
7636
|
this.externalElements.ondragover = (e) => e.preventDefault();
|