@labelbee/lb-annotation 1.14.0-alpha.3 → 1.14.0-alpha.5
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/dist/_virtual/MathUtilsWorker.js +1 -8
- package/dist/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -35
- package/dist/_virtual/filterBoxWorker.js +1 -8
- package/dist/_virtual/highlightWorker.js +1 -8
- package/dist/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -5
- package/dist/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -5
- package/dist/assets/attributeIcon/icon_cuboidMore.svg.js +5 -5
- package/dist/assets/attributeIcon/icon_cuboidRight.svg.js +5 -5
- package/dist/assets/attributeIcon/icon_cuboidTop.svg.js +12 -5
- package/dist/assets/attributeIcon/icon_editFEN.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_editHUANG.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_editLAN.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_editLV.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_editQING.svg.js +1 -5
- package/dist/constant/annotation.js +1 -127
- package/dist/constant/annotationTask.js +1 -30
- package/dist/constant/defaultConfig.js +1 -266
- package/dist/constant/keyCode.js +1 -38
- package/dist/constant/style.js +1 -98
- package/dist/constant/tool.js +1 -236
- package/dist/core/index.js +1 -150
- package/dist/core/pointCloud/OrbitControls.js +1 -665
- package/dist/core/pointCloud/PCDLoader.js +2 -260
- package/dist/core/pointCloud/annotation.js +1 -215
- package/dist/core/pointCloud/cache.js +1 -53
- package/dist/core/pointCloud/index.js +5 -991
- package/dist/core/pointCloud/matrix.js +1 -138
- package/dist/core/scheduler.js +1 -233
- package/dist/core/toolOperation/LineToolOperation.js +1 -1434
- package/dist/core/toolOperation/ScribbleTool.js +1 -292
- package/dist/core/toolOperation/TextToolOperation.js +1 -131
- package/dist/core/toolOperation/ViewOperation.js +1 -556
- package/dist/core/toolOperation/basicToolOperation.js +1 -881
- package/dist/core/toolOperation/checkOperation.js +1 -208
- package/dist/core/toolOperation/cuboidOperation.js +1 -754
- package/dist/core/toolOperation/cuboidToggleButtonClass.js +7 -152
- package/dist/core/toolOperation/eventListener.js +1 -37
- package/dist/core/toolOperation/measureOperation.js +1 -41
- package/dist/core/toolOperation/pointCloud2dOperation.js +1 -365
- package/dist/core/toolOperation/pointOperation.js +1 -696
- package/dist/core/toolOperation/polygonOperation.js +1 -1251
- package/dist/core/toolOperation/rectOperation.js +1 -1233
- package/dist/core/toolOperation/segmentByRect.js +1 -174
- package/dist/core/toolOperation/tagOperation.js +3 -201
- package/dist/core/toolOperation/textAttributeClass.js +16 -182
- package/dist/index.js +1 -185
- package/dist/locales/constants.js +1 -24
- package/dist/locales/en_US/message.js +1 -25
- package/dist/locales/index.js +1 -19
- package/dist/locales/zh_CN/message.js +1 -25
- package/dist/newCore/CanvasScheduler.js +1 -35
- package/dist/utils/ActionsHistory.js +1 -84
- package/dist/utils/ImgUtils.js +1 -23
- package/dist/utils/MathUtils.js +2 -385
- package/dist/utils/VectorUtils.js +1 -25
- package/dist/utils/tool/AttributeUtils.js +1 -218
- package/dist/utils/tool/AxisUtils.js +1 -340
- package/dist/utils/tool/CanvasUtils.js +1 -62
- package/dist/utils/tool/CommonToolUtils.js +1 -174
- package/dist/utils/tool/CuboidUtils.js +1 -704
- package/dist/utils/tool/DblClickEventListener.js +1 -102
- package/dist/utils/tool/DrawUtils.js +3 -492
- package/dist/utils/tool/EnhanceCommonToolUtils.js +1 -53
- package/dist/utils/tool/ImgPosUtils.js +1 -58
- package/dist/utils/tool/LineToolUtils.js +1 -261
- package/dist/utils/tool/MarkerUtils.js +1 -56
- package/dist/utils/tool/PolygonUtils.js +1 -460
- package/dist/utils/tool/RectUtils.js +1 -155
- package/dist/utils/tool/RenderDomClass.js +7 -57
- package/dist/utils/tool/RenderDomUtils.js +4 -21
- package/dist/utils/tool/StyleUtils.js +1 -31
- package/dist/utils/tool/TagUtils.js +1 -129
- package/dist/utils/tool/UnitUtils.js +1 -12
- package/dist/utils/tool/ZoomUtils.js +1 -72
- package/dist/utils/tool/polygonTool.js +1 -133
- package/dist/utils/uuid.js +1 -26
- package/es/_virtual/MathUtilsWorker.js +1 -6
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -31
- package/es/_virtual/filterBoxWorker.js +1 -6
- package/es/_virtual/highlightWorker.js +1 -6
- package/es/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -3
- package/es/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -3
- package/es/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -3
- package/es/assets/attributeIcon/icon_cuboidMore.svg.js +5 -3
- package/es/assets/attributeIcon/icon_cuboidRight.svg.js +5 -3
- package/es/assets/attributeIcon/icon_cuboidTop.svg.js +12 -3
- package/es/assets/attributeIcon/icon_editFEN.svg.js +1 -3
- package/es/assets/attributeIcon/icon_editHUANG.svg.js +1 -3
- package/es/assets/attributeIcon/icon_editLAN.svg.js +1 -3
- package/es/assets/attributeIcon/icon_editLV.svg.js +1 -3
- package/es/assets/attributeIcon/icon_editQING.svg.js +1 -3
- package/es/constant/annotation.js +1 -113
- package/es/constant/annotationTask.js +1 -25
- package/es/constant/defaultConfig.js +1 -260
- package/es/constant/keyCode.js +1 -36
- package/es/constant/style.js +1 -74
- package/es/constant/tool.js +1 -220
- package/es/core/index.js +1 -148
- package/es/core/pointCloud/OrbitControls.js +1 -661
- package/es/core/pointCloud/PCDLoader.js +2 -256
- package/es/core/pointCloud/annotation.js +1 -211
- package/es/core/pointCloud/cache.js +1 -49
- package/es/core/pointCloud/index.js +5 -962
- package/es/core/pointCloud/matrix.js +1 -109
- package/es/core/scheduler.js +1 -228
- package/es/core/toolOperation/LineToolOperation.js +1 -1421
- package/es/core/toolOperation/ScribbleTool.js +1 -290
- package/es/core/toolOperation/TextToolOperation.js +1 -129
- package/es/core/toolOperation/ViewOperation.js +1 -549
- package/es/core/toolOperation/basicToolOperation.js +1 -877
- package/es/core/toolOperation/checkOperation.js +1 -206
- package/es/core/toolOperation/cuboidOperation.js +1 -752
- package/es/core/toolOperation/cuboidToggleButtonClass.js +7 -150
- package/es/core/toolOperation/eventListener.js +1 -35
- package/es/core/toolOperation/measureOperation.js +1 -39
- package/es/core/toolOperation/pointCloud2dOperation.js +1 -359
- package/es/core/toolOperation/pointOperation.js +1 -690
- package/es/core/toolOperation/polygonOperation.js +1 -1245
- package/es/core/toolOperation/rectOperation.js +1 -1228
- package/es/core/toolOperation/segmentByRect.js +1 -172
- package/es/core/toolOperation/tagOperation.js +3 -199
- package/es/core/toolOperation/textAttributeClass.js +16 -180
- package/es/index.js +1 -46
- package/es/locales/constants.js +1 -22
- package/es/locales/en_US/message.js +1 -23
- package/es/locales/index.js +1 -17
- package/es/locales/zh_CN/message.js +1 -23
- package/es/newCore/CanvasScheduler.js +1 -31
- package/es/utils/ActionsHistory.js +1 -78
- package/es/utils/ImgUtils.js +1 -21
- package/es/utils/MathUtils.js +2 -380
- package/es/utils/VectorUtils.js +1 -23
- package/es/utils/tool/AttributeUtils.js +1 -212
- package/es/utils/tool/AxisUtils.js +1 -335
- package/es/utils/tool/CanvasUtils.js +1 -60
- package/es/utils/tool/CommonToolUtils.js +1 -172
- package/es/utils/tool/CuboidUtils.js +1 -680
- package/es/utils/tool/DblClickEventListener.js +1 -100
- package/es/utils/tool/DrawUtils.js +3 -490
- package/es/utils/tool/EnhanceCommonToolUtils.js +1 -48
- package/es/utils/tool/ImgPosUtils.js +1 -56
- package/es/utils/tool/LineToolUtils.js +1 -255
- package/es/utils/tool/MarkerUtils.js +1 -54
- package/es/utils/tool/PolygonUtils.js +1 -458
- package/es/utils/tool/RectUtils.js +1 -153
- package/es/utils/tool/RenderDomClass.js +7 -55
- package/es/utils/tool/RenderDomUtils.js +4 -19
- package/es/utils/tool/StyleUtils.js +1 -29
- package/es/utils/tool/TagUtils.js +1 -127
- package/es/utils/tool/UnitUtils.js +1 -10
- package/es/utils/tool/ZoomUtils.js +1 -70
- package/es/utils/tool/polygonTool.js +1 -126
- package/es/utils/uuid.js +1 -24
- package/package.json +3 -4
- package/LICENSE +0 -203
- package/dist/core/pointCloud/segmentation.js +0 -144
- package/dist/core/pointCloud/selector/Sse3dLassoSelector.js +0 -26
- package/dist/core/pointCloud/selector/Sse3dSelector.js +0 -16
- package/dist/types/core/pointCloud/segmentation.d.ts +0 -0
- package/dist/types/core/pointCloud/selector/Sse3dLassoSelector.d.ts +0 -0
- package/dist/types/core/pointCloud/selector/Sse3dSelector.d.ts +0 -0
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +0 -12
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +0 -7
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +0 -11
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +0 -18
- package/es/core/pointCloud/segmentation.js +0 -120
- package/es/core/pointCloud/selector/Sse3dLassoSelector.js +0 -24
- package/es/core/pointCloud/selector/Sse3dSelector.js +0 -14
- package/es/core/toolOperation/scribbleTool2.js +0 -249
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { ImgConversionUtils } from '@labelbee/lb-utils';
|
|
2
|
-
import AxisUtils from '../../utils/tool/AxisUtils.js';
|
|
3
|
-
import DrawUtils from '../../utils/tool/DrawUtils.js';
|
|
4
|
-
import { EToolName, EScribblePattern } from '../../constant/tool.js';
|
|
5
|
-
import CommonToolUtils from '../../utils/tool/CommonToolUtils.js';
|
|
6
|
-
import AttributeUtils from '../../utils/tool/AttributeUtils.js';
|
|
7
|
-
import { BasicToolOperation } from './basicToolOperation.js';
|
|
8
|
-
|
|
9
|
-
const DEFAULT_PEN_SIZE = 20;
|
|
10
|
-
const DEFAULT_COLOR = "white";
|
|
11
|
-
class ScribbleTool extends BasicToolOperation {
|
|
12
|
-
constructor(props) {
|
|
13
|
-
super(props);
|
|
14
|
-
this.toolName = EToolName.ScribbleTool;
|
|
15
|
-
this.action = EScribblePattern.Scribble;
|
|
16
|
-
this.getOriginCoordinate = (e) => {
|
|
17
|
-
return AxisUtils.changePointByZoom(this.getCoordinateUnderZoom(e), 1 / this.zoom);
|
|
18
|
-
};
|
|
19
|
-
this.onMouseDown = (e) => {
|
|
20
|
-
if (super.onMouseDown(e) || this.forbidMouseOperation || !this.imgInfo) {
|
|
21
|
-
return void 0;
|
|
22
|
-
}
|
|
23
|
-
this.initCacheCanvas(this.imgNode);
|
|
24
|
-
this.mouseEvents("onMouseDown").call(this, e);
|
|
25
|
-
};
|
|
26
|
-
this.onMouseMove = (e) => {
|
|
27
|
-
if (super.onMouseMove(e) || this.forbidMouseOperation || !this.imgInfo) {
|
|
28
|
-
return void 0;
|
|
29
|
-
}
|
|
30
|
-
this.mouseEvents("onMouseMove").call(this, e);
|
|
31
|
-
};
|
|
32
|
-
this.onMouseUp = (e) => {
|
|
33
|
-
if (super.onMouseUp(e) || this.forbidMouseOperation || !this.imgInfo) {
|
|
34
|
-
return void 0;
|
|
35
|
-
}
|
|
36
|
-
this.mouseEvents("onMouseUp").call(this, e);
|
|
37
|
-
};
|
|
38
|
-
this.mouseEvents = (eventType) => {
|
|
39
|
-
const events = {
|
|
40
|
-
[EScribblePattern.Scribble]: {
|
|
41
|
-
onMouseMove: this.onScribbleMove,
|
|
42
|
-
onMouseUp: this.onScribbleEnd,
|
|
43
|
-
onMouseDown: this.onScribbleStart
|
|
44
|
-
},
|
|
45
|
-
[EScribblePattern.Erase]: {
|
|
46
|
-
onMouseMove: this.onEraseMove,
|
|
47
|
-
onMouseUp: this.onEraseEnd,
|
|
48
|
-
onMouseDown: this.onEraseStart
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
return events[this.action][eventType];
|
|
52
|
-
};
|
|
53
|
-
this.setPattern = (pattern) => {
|
|
54
|
-
this.action = pattern;
|
|
55
|
-
};
|
|
56
|
-
this.penSize = DEFAULT_PEN_SIZE;
|
|
57
|
-
}
|
|
58
|
-
get color() {
|
|
59
|
-
var _a, _b;
|
|
60
|
-
return (_b = (_a = this == null ? void 0 : this.defaultAttributeInfo) == null ? void 0 : _a.color) != null ? _b : DEFAULT_COLOR;
|
|
61
|
-
}
|
|
62
|
-
get penSizeWithZoom() {
|
|
63
|
-
return this.penSize / this.zoom;
|
|
64
|
-
}
|
|
65
|
-
setPenSize(size) {
|
|
66
|
-
this.penSize = size;
|
|
67
|
-
}
|
|
68
|
-
initCacheCanvas(imgNode) {
|
|
69
|
-
if (this.cacheCanvas || !imgNode) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const {canvas, ctx} = ImgConversionUtils.createCanvas(imgNode);
|
|
73
|
-
this.cacheCanvas = canvas;
|
|
74
|
-
this.cacheContext = ctx;
|
|
75
|
-
}
|
|
76
|
-
updateCacheCanvasSize(imgNode) {
|
|
77
|
-
if (this.cacheCanvas) {
|
|
78
|
-
this.cacheCanvas.width = imgNode.width;
|
|
79
|
-
this.cacheCanvas.height = imgNode.height;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
updateUrl2CacheContext(url) {
|
|
83
|
-
ImgConversionUtils.createImgDom(url).then((img) => {
|
|
84
|
-
if (!this.cacheContext) {
|
|
85
|
-
this.initCacheCanvas(img);
|
|
86
|
-
}
|
|
87
|
-
if (this.cacheContext) {
|
|
88
|
-
this.cacheContext.save();
|
|
89
|
-
this.clearResult();
|
|
90
|
-
this.cacheContext.drawImage(img, 0, 0, img.width, img.height);
|
|
91
|
-
this.cacheContext.restore();
|
|
92
|
-
this.render();
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
setImgNode(imgNode, basicImgInfo) {
|
|
97
|
-
super.setImgNode(imgNode, basicImgInfo);
|
|
98
|
-
if (this.cacheCanvas) {
|
|
99
|
-
this.updateCacheCanvasSize(imgNode);
|
|
100
|
-
} else {
|
|
101
|
-
this.initCacheCanvas(imgNode);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
setResult(data) {
|
|
105
|
-
var _a;
|
|
106
|
-
const {url} = (_a = data == null ? void 0 : data[0]) != null ? _a : {};
|
|
107
|
-
this.history.initRecord([url], !!url);
|
|
108
|
-
this.clearResult();
|
|
109
|
-
if (!url) {
|
|
110
|
-
this.render();
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
this.updateUrl2CacheContext(url);
|
|
114
|
-
}
|
|
115
|
-
onKeyDown(e) {
|
|
116
|
-
if (!CommonToolUtils.hotkeyFilter(e) || super.onKeyDown(e) === false) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
const {keyCode} = e;
|
|
120
|
-
const keyCode2Attribute = AttributeUtils.getAttributeByKeycode(keyCode, this.config.attributeList);
|
|
121
|
-
if (keyCode2Attribute !== void 0) {
|
|
122
|
-
this.setDefaultAttribute(keyCode2Attribute);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
eventBinding() {
|
|
126
|
-
super.eventBinding();
|
|
127
|
-
}
|
|
128
|
-
setDefaultAttribute(attributeValue) {
|
|
129
|
-
const attributeInfo = this.config.attributeList.find((v) => v.value === attributeValue);
|
|
130
|
-
if (attributeInfo) {
|
|
131
|
-
this.defaultAttribute = attributeInfo.value;
|
|
132
|
-
this.defaultAttributeInfo = attributeInfo;
|
|
133
|
-
this.emit("changeAttributeSidebar");
|
|
134
|
-
this.render();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
clearStatusAfterLeave() {
|
|
138
|
-
this.onScribbleEnd();
|
|
139
|
-
this.startPoint = void 0;
|
|
140
|
-
}
|
|
141
|
-
onMouseLeave() {
|
|
142
|
-
super.onMouseLeave();
|
|
143
|
-
this.clearStatusAfterLeave();
|
|
144
|
-
}
|
|
145
|
-
onScribbleStart(e) {
|
|
146
|
-
if (!this.cacheContext) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
this.cacheContext.save();
|
|
150
|
-
this.cacheContext.beginPath();
|
|
151
|
-
this.cacheContext.strokeStyle = this.color;
|
|
152
|
-
this.cacheContext.lineWidth = this.penSizeWithZoom;
|
|
153
|
-
this.cacheContext.lineCap = "round";
|
|
154
|
-
this.cacheContext.lineJoin = "round";
|
|
155
|
-
const originCoordinate = AxisUtils.changePointByZoom(this.getCoordinateUnderZoom(e), 1 / this.zoom);
|
|
156
|
-
this.cacheContext.moveTo(originCoordinate.x, originCoordinate.y);
|
|
157
|
-
this.startPoint = originCoordinate;
|
|
158
|
-
}
|
|
159
|
-
onScribbleMove(e) {
|
|
160
|
-
if (e.buttons === 1 && this.cacheContext && this.startPoint) {
|
|
161
|
-
const originCoordinate = this.getOriginCoordinate(e);
|
|
162
|
-
this.cacheContext.lineTo(originCoordinate.x, originCoordinate.y);
|
|
163
|
-
this.cacheContext.stroke();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
onScribbleEnd() {
|
|
167
|
-
var _a, _b, _c;
|
|
168
|
-
if (this.startPoint) {
|
|
169
|
-
(_a = this.cacheContext) == null ? void 0 : _a.closePath();
|
|
170
|
-
(_b = this.cacheContext) == null ? void 0 : _b.restore();
|
|
171
|
-
this.startPoint = void 0;
|
|
172
|
-
this.history.pushHistory((_c = this.cacheCanvas) == null ? void 0 : _c.toDataURL("image/png", 0));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
eraseArc(e) {
|
|
176
|
-
var _a;
|
|
177
|
-
if (this.cacheContext) {
|
|
178
|
-
const originCoordinate = this.getOriginCoordinate(e);
|
|
179
|
-
this.cacheContext.save();
|
|
180
|
-
this.cacheContext.beginPath();
|
|
181
|
-
this.cacheContext.arc(originCoordinate.x, originCoordinate.y, this.penSizeWithZoom / 2, 0, Math.PI * 2, false);
|
|
182
|
-
this.cacheContext.clip();
|
|
183
|
-
this.cacheContext.clearRect(0, 0, this.cacheContext.canvas.width, this.cacheContext.canvas.height);
|
|
184
|
-
(_a = this.cacheContext) == null ? void 0 : _a.restore();
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
onEraseStart(e) {
|
|
188
|
-
if (!this.cacheContext || e.buttons !== 1) {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
this.eraseArc(e);
|
|
192
|
-
}
|
|
193
|
-
onEraseMove(e) {
|
|
194
|
-
if (!this.cacheContext || e.buttons !== 1) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
this.eraseArc(e);
|
|
198
|
-
}
|
|
199
|
-
onEraseEnd() {
|
|
200
|
-
}
|
|
201
|
-
exportData() {
|
|
202
|
-
var _a;
|
|
203
|
-
const imgBase64 = (_a = this.cacheCanvas) == null ? void 0 : _a.toDataURL("image/png", 0);
|
|
204
|
-
return [[], this.basicImgInfo, {imgBase64}];
|
|
205
|
-
}
|
|
206
|
-
clearCacheCanvas() {
|
|
207
|
-
var _a;
|
|
208
|
-
(_a = this.cacheContext) == null ? void 0 : _a.clearRect(0, 0, this.cacheContext.canvas.width, this.cacheContext.canvas.height);
|
|
209
|
-
this.render();
|
|
210
|
-
}
|
|
211
|
-
clearResult() {
|
|
212
|
-
this.clearCacheCanvas();
|
|
213
|
-
}
|
|
214
|
-
renderPoint(radius) {
|
|
215
|
-
DrawUtils.drawCircleWithFill(this.canvas, this.coord, radius, {color: this.color});
|
|
216
|
-
}
|
|
217
|
-
render() {
|
|
218
|
-
super.render();
|
|
219
|
-
if (!this.ctx || !this.cacheCanvas) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
this.ctx.save();
|
|
223
|
-
this.ctx.globalAlpha = 0.5;
|
|
224
|
-
DrawUtils.drawImg(this.canvas, this.cacheCanvas, {
|
|
225
|
-
zoom: this.zoom,
|
|
226
|
-
currentPos: this.currentPos,
|
|
227
|
-
rotate: this.rotate
|
|
228
|
-
});
|
|
229
|
-
this.ctx.restore();
|
|
230
|
-
if (this.forbidOperation || this.forbidCursorLine) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
this.renderPoint(this.penSize / 2);
|
|
234
|
-
}
|
|
235
|
-
undo() {
|
|
236
|
-
const url = this.history.undo();
|
|
237
|
-
if (url && this.cacheCanvas) {
|
|
238
|
-
this.updateUrl2CacheContext(url);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
redo() {
|
|
242
|
-
const url = this.history.redo();
|
|
243
|
-
if (url && this.cacheCanvas) {
|
|
244
|
-
this.updateUrl2CacheContext(url);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
export { ScribbleTool as default };
|