@meta2d/core 1.0.14 → 1.0.16
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 +2 -0
- package/src/canvas/canvas.js +23 -13
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.d.ts +35 -12
- package/src/core.js +536 -88
- package/src/core.js.map +1 -1
- package/src/dialog/dialog.d.ts +14 -0
- package/src/dialog/dialog.js +77 -0
- package/src/dialog/dialog.js.map +1 -0
- package/src/dialog/index.d.ts +1 -0
- package/src/dialog/index.js +2 -0
- package/src/dialog/index.js.map +1 -0
- package/src/event/event.d.ts +48 -3
- package/src/event/event.js +3 -0
- package/src/event/event.js.map +1 -1
- package/src/options.d.ts +1 -0
- package/src/options.js +1 -0
- package/src/options.js.map +1 -1
- package/src/pen/model.d.ts +2 -1
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.d.ts +1 -0
- package/src/pen/render.js +20 -7
- package/src/pen/render.js.map +1 -1
- package/src/scroll/scroll.d.ts +3 -0
- package/src/scroll/scroll.js +24 -0
- package/src/scroll/scroll.js.map +1 -1
- package/src/store/store.d.ts +22 -0
- package/src/store/store.js.map +1 -1
- package/src/tooltip/tooltip.js +2 -2
- package/src/tooltip/tooltip.js.map +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { Scroll } from '../scroll';
|
|
|
12
12
|
import { CanvasImage } from './canvasImage';
|
|
13
13
|
import { MagnifierCanvas } from './magnifierCanvas';
|
|
14
14
|
import { Meta2d } from '../core';
|
|
15
|
+
import { Dialog } from '../dialog';
|
|
15
16
|
export declare const movingSuffix: "-moving";
|
|
16
17
|
export declare class Canvas {
|
|
17
18
|
parent: Meta2d;
|
|
@@ -102,6 +103,7 @@ export declare class Canvas {
|
|
|
102
103
|
canvasImage: CanvasImage;
|
|
103
104
|
canvasImageBottom: CanvasImage;
|
|
104
105
|
magnifierCanvas: MagnifierCanvas;
|
|
106
|
+
dialog: Dialog;
|
|
105
107
|
stopPropagation: (e: MouseEvent) => void;
|
|
106
108
|
constructor(parent: Meta2d, parentElement: HTMLElement, store: Meta2dStore);
|
|
107
109
|
curve: typeof curve;
|
package/src/canvas/canvas.js
CHANGED
|
@@ -96,6 +96,7 @@ import { Scroll } from '../scroll';
|
|
|
96
96
|
import { CanvasImage } from './canvasImage';
|
|
97
97
|
import { MagnifierCanvas } from './magnifierCanvas';
|
|
98
98
|
import { lockedError } from '../utils/error';
|
|
99
|
+
import { Dialog } from '../dialog';
|
|
99
100
|
export var movingSuffix = '-moving';
|
|
100
101
|
var Canvas = /** @class */ (function () {
|
|
101
102
|
function Canvas(parent, parentElement, store) {
|
|
@@ -2539,6 +2540,7 @@ var Canvas = /** @class */ (function () {
|
|
|
2539
2540
|
var hover = _this.store.data.pens.find(function (item) { return item.calculative.hover === true; });
|
|
2540
2541
|
setHover(hover, false);
|
|
2541
2542
|
};
|
|
2543
|
+
this.dialog = new Dialog(parentElement);
|
|
2542
2544
|
if (this.store.options.scroll) {
|
|
2543
2545
|
this.scroll = new Scroll(this);
|
|
2544
2546
|
}
|
|
@@ -4117,15 +4119,18 @@ var Canvas = /** @class */ (function () {
|
|
|
4117
4119
|
}, 50);
|
|
4118
4120
|
};
|
|
4119
4121
|
Canvas.prototype.translate = function (x, y) {
|
|
4122
|
+
var _this = this;
|
|
4120
4123
|
if (x === void 0) { x = 0; }
|
|
4121
4124
|
if (y === void 0) { y = 0; }
|
|
4122
4125
|
this.store.data.x += x * this.store.data.scale;
|
|
4123
4126
|
this.store.data.y += y * this.store.data.scale;
|
|
4124
4127
|
this.store.data.x = Math.round(this.store.data.x);
|
|
4125
4128
|
this.store.data.y = Math.round(this.store.data.y);
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
+
setTimeout(function () {
|
|
4130
|
+
_this.canvasImage.init();
|
|
4131
|
+
_this.canvasImageBottom.init();
|
|
4132
|
+
_this.render();
|
|
4133
|
+
});
|
|
4129
4134
|
this.store.emitter.emit('translate', {
|
|
4130
4135
|
x: this.store.data.x,
|
|
4131
4136
|
y: this.store.data.y,
|
|
@@ -4215,14 +4220,16 @@ var Canvas = /** @class */ (function () {
|
|
|
4215
4220
|
_this.execPenResize(pen);
|
|
4216
4221
|
});
|
|
4217
4222
|
this.calcActiveRect();
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
map.
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4223
|
+
setTimeout(function () {
|
|
4224
|
+
_this.canvasImage.init();
|
|
4225
|
+
_this.canvasImageBottom.init();
|
|
4226
|
+
var map = _this.parent.map;
|
|
4227
|
+
if (map && map.isShow) {
|
|
4228
|
+
map.setView();
|
|
4229
|
+
}
|
|
4230
|
+
_this.render();
|
|
4231
|
+
_this.store.emitter.emit('scale', _this.store.data.scale);
|
|
4232
|
+
});
|
|
4226
4233
|
};
|
|
4227
4234
|
Canvas.prototype.rotatePens = function (e) {
|
|
4228
4235
|
var e_17, _a;
|
|
@@ -4478,7 +4485,9 @@ var Canvas = /** @class */ (function () {
|
|
|
4478
4485
|
// 线宽为 0 ,看不到外边框,拖动过程中给个外边框
|
|
4479
4486
|
pen.lineWidth === 0 && (value.lineWidth = 1);
|
|
4480
4487
|
// TODO: 例如 pen.name = 'triangle' 的情况,但有图片,是否还需要变成矩形呢?
|
|
4481
|
-
if (isDomShapes.includes(pen.name) ||
|
|
4488
|
+
if (isDomShapes.includes(pen.name) ||
|
|
4489
|
+
_this.store.options.domShapes.includes(pen.name) ||
|
|
4490
|
+
pen.image) {
|
|
4482
4491
|
// 修改名称会执行 onDestroy ,清空它
|
|
4483
4492
|
value.name = 'rectangle';
|
|
4484
4493
|
value.onDestroy = undefined;
|
|
@@ -6215,9 +6224,10 @@ var Canvas = /** @class */ (function () {
|
|
|
6215
6224
|
this.render();
|
|
6216
6225
|
};
|
|
6217
6226
|
Canvas.prototype.destroy = function () {
|
|
6218
|
-
var _a;
|
|
6227
|
+
var _a, _b;
|
|
6219
6228
|
this.scroll && this.scroll.destroy();
|
|
6220
6229
|
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
6230
|
+
(_b = this.dialog) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
6221
6231
|
// ios
|
|
6222
6232
|
this.externalElements.removeEventListener('gesturestart', this.onGesturestart);
|
|
6223
6233
|
this.externalElements.ondragover = function (e) { return e.preventDefault(); };
|