@duyafeng/pseudocolor-viewer 0.2.1 → 0.2.2
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/PseudoColorViewer.vue +1304 -1664
- package/package.json +1 -1
package/PseudoColorViewer.vue
CHANGED
|
@@ -1,1664 +1,1304 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-dialog fullscreen :show-header="false" :visible.sync="imageDialog" @closed="handleDialogClosed">
|
|
3
|
-
<div class="closed" @click="handleBeforeClose"><i class="el-icon-circle-close"></i></div>
|
|
4
|
-
<div class="container">
|
|
5
|
-
<div class="stats-container">
|
|
6
|
-
<RectInfo ref="rectPanel" v-if="rectTableData.visible" :rectTableData="rectTableData"
|
|
7
|
-
@closeRectInfoList="closeRectInfoList" @deleteRectFromList="deleteRectFromList"
|
|
8
|
-
@clearAllMeasurements="clearAllMeasurements"></RectInfo>
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
<div class="body-container" ref="parent">
|
|
12
|
-
<!-- 缩略图(部位列表) -->
|
|
13
|
-
<div class="init-pic">
|
|
14
|
-
<div class="img-container">
|
|
15
|
-
<div class="pic-item" v-for="item in canvasList" :key="item.bodyFlag">
|
|
16
|
-
<div class="img-item" :ref="'imgItem' + item.bodyFlag" @click="clickGary(item)">
|
|
17
|
-
<div :class="flag == item.bodyFlag ? 'activeCanvas' : ''"></div>
|
|
18
|
-
<img v-if="!item.imgName" class="imgClass" :src="defaultImage" alt="" />
|
|
19
|
-
<canvas v-else :id="'resultCanvas' + item.bodyFlag" :ref="'resultCanvas' + item.bodyFlag"
|
|
20
|
-
class="img-item"></canvas>
|
|
21
|
-
</div>
|
|
22
|
-
<div class="picText" :class="flag == item.bodyFlag ? 'active' : ''">{{ item.btnName }}</div>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
<div class="inputContainer">
|
|
26
|
-
<div class="window-row">
|
|
27
|
-
<span class="row-label">温窗起点</span>
|
|
28
|
-
<span class="row-value">{{ wlText }}</span>
|
|
29
|
-
<div class="row-container">
|
|
30
|
-
<button class="row-btn" @click="stepWl(-0.1)">‹</button>
|
|
31
|
-
<div class="row-scale" @pointerdown="onScaleDown($event, 'wl')">
|
|
32
|
-
<div class="row-rail">
|
|
33
|
-
<span class="row-fill" :style="{ width: wlPct + '%' }"></span>
|
|
34
|
-
<div class="row-thumb" :style="{ left: wlPct + '%' }"></div>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
<button class="row-btn" @click="stepWl(0.1)">›</button>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
<div class="window-row">
|
|
41
|
-
<span class="row-label">温窗宽度</span>
|
|
42
|
-
<span class="row-value">{{ wwText }}</span>
|
|
43
|
-
<div class="row-container">
|
|
44
|
-
<button class="row-btn" @click="stepWw(-0.5)">‹</button>
|
|
45
|
-
<div class="row-scale" @pointerdown="onScaleDown($event, 'ww')">
|
|
46
|
-
<div class="row-rail">
|
|
47
|
-
<span class="row-fill" :style="{ width: wwPct + '%' }"></span>
|
|
48
|
-
<div class="row-thumb" :style="{ left: wwPct + '%' }"></div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
<button class="row-btn" @click="stepWw(0.5)">›</button>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
<!-- 右侧区域:工具条 + 两个 canvas 画布 -->
|
|
57
|
-
<div class="right-area">
|
|
58
|
-
<div class="red1-switch">
|
|
59
|
-
<!-- 用户信息(与切换图像同一行,左右排列) -->
|
|
60
|
-
<span class="user-info-item"><em>姓名:</em>{{ currentUserInfo.userName }}</span>
|
|
61
|
-
<span class="user-info-item"><em>性别:</em>{{ currentUserInfo.userSex }}</span>
|
|
62
|
-
<span class="user-info-item"><em>手机号:</em>{{ currentUserInfo.userPhone }}</span>
|
|
63
|
-
<el-checkbox border v-model="red1Mode" icon-size="40px" @change="onRed1Change">切换图像</el-checkbox>
|
|
64
|
-
<div class="measure-tool-group">
|
|
65
|
-
<span class="mtg-label">测温工具:</span>
|
|
66
|
-
<button class="mtg-btn"
|
|
67
|
-
:class="{ active: measureToolActive && measureToolShape === 'point' }" @click="selectMeasureTool('point')"
|
|
68
|
-
title="点测温">⌖</button>
|
|
69
|
-
<button class="mtg-btn"
|
|
70
|
-
:class="{ active: measureToolActive && measureToolShape === 'rect' }" @click="selectMeasureTool('rect')"
|
|
71
|
-
title="方框测温">▢</button>
|
|
72
|
-
<button class="mtg-btn"
|
|
73
|
-
:class="{ active: measureToolActive && measureToolShape === 'circle' }"
|
|
74
|
-
@click="selectMeasureTool('circle')" title="圆形测温">◯</button>
|
|
75
|
-
</div>
|
|
76
|
-
<el-button v-show="rectTableData.infoList.length > 0" class="reset-panel-btn" size="mini"
|
|
77
|
-
icon="el-icon-refresh" @click="resetRectPanel">还原弹框</el-button>
|
|
78
|
-
</div>
|
|
79
|
-
<div class="color-map">
|
|
80
|
-
<div class="color-item" v-for="(item, idx) in thumbnailList" :key="item.bodyFlag"
|
|
81
|
-
@click="switchRightCanvas(item)">
|
|
82
|
-
<div class="color-img" :ref="'colorImgItem' + item.bodyFlag"
|
|
83
|
-
:class="{ 'is-active': item.bodyFlag === currentActiveCanvas.bodyFlag }">
|
|
84
|
-
<div class="title" :id="'title' + item.bodyFlag" :ref="'title' + item.bodyFlag">
|
|
85
|
-
<div v-if="item.btnName">{{ item.btnName }}</div>
|
|
86
|
-
</div>
|
|
87
|
-
<div class="color-body">
|
|
88
|
-
<img v-if="!item.imgName" :src="defaultImage" class="placeholder-image" />
|
|
89
|
-
<canvas v-else :id="'resultCanvas_' + item.bodyFlag" :ref="'resultCanvas_' + item.bodyFlag"
|
|
90
|
-
@wheel.prevent="handleScroll"
|
|
91
|
-
:class="['canvas-item', { 'active-canvas': item.bodyFlag === currentActiveCanvas.bodyFlag }]"></canvas>
|
|
92
|
-
<div class="floating-temp"></div>
|
|
93
|
-
</div>
|
|
94
|
-
<div :class="item.id == 1 ? 'tempBtn1' : 'tempBtn2'" v-if="item.buttonName">
|
|
95
|
-
<el-button style="height: 40px" type="primary" @click="processImage">{{ item.buttonName }}</el-button>
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
<div>
|
|
102
|
-
<canvas style="display: none" id="processedCanvas" ref="processedCanvas"></canvas>
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
</el-dialog>
|
|
107
|
-
</template>
|
|
108
|
-
|
|
109
|
-
<script>
|
|
110
|
-
import { MedicalColorProcessor, ImageDisplayManager, WindowLevelController, canvasUtils, ImageQueue } from '@duyafeng/pseudocolor/legacy/pseudoColor';
|
|
111
|
-
import RectInfo from './Rect.vue';
|
|
112
|
-
import { getDefaultPositions } from './positionPresets.js';
|
|
113
|
-
|
|
114
|
-
// ══════════════════════════════════════════════════════════════
|
|
115
|
-
// Monkey-patches for @duyafeng/pseudocolor legacy ImageDisplayManager
|
|
116
|
-
// legacy 版硬编码 288×384,原版动态匹配 256×192 / 288×384 + 旋转处理
|
|
117
|
-
// ══════════════════════════════════════════════════════════════
|
|
118
|
-
const CANDIDATE_FRAMES = [
|
|
119
|
-
{ width: 256, height: 192, rotate: true },
|
|
120
|
-
{ width: 288, height: 384, rotate: false },
|
|
121
|
-
];
|
|
122
|
-
const TEMP_BYTES_PER_PIXEL = [1, 4, 8];
|
|
123
|
-
|
|
124
|
-
// Patch 1: 缺 setRed1Mode
|
|
125
|
-
ImageDisplayManager.prototype.setRed1Mode = function(mode) {
|
|
126
|
-
this.red1Mode = !!mode;
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// Patch 2: 动态匹配帧尺寸(256×192 / 288×384)
|
|
130
|
-
ImageDisplayManager.prototype.resolveSourceFrame = function(byteLength, bytesPerPixelList) {
|
|
131
|
-
bytesPerPixelList = bytesPerPixelList || [1];
|
|
132
|
-
for (const bytesPerPixel of bytesPerPixelList) {
|
|
133
|
-
for (const frame of CANDIDATE_FRAMES) {
|
|
134
|
-
if (byteLength === frame.width * frame.height * bytesPerPixel) {
|
|
135
|
-
return { ...frame, bytesPerPixel };
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
throw new Error(
|
|
140
|
-
`数据长度不匹配!检测到 ${byteLength} 字节,预期尺寸 ${CANDIDATE_FRAMES.map(f => `${f.width}×${f.height}`).join(' 或 ')}、单像素 ${bytesPerPixelList.join('/')} 字节`
|
|
141
|
-
);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
// Patch 3: 旋转相关(256×192 需逆时针旋转 90°)
|
|
145
|
-
ImageDisplayManager.prototype.getDisplayFrame = function({ width, height, rotate }) {
|
|
146
|
-
return rotate ? { width: height, height: width } : { width, height };
|
|
147
|
-
};
|
|
148
|
-
ImageDisplayManager.prototype.rotateCounterclockwise90 = function(data, width, height, stride) {
|
|
149
|
-
stride = stride || 1;
|
|
150
|
-
const rotated = new data.constructor(data.length);
|
|
151
|
-
for (let y = 0; y < height; y++) {
|
|
152
|
-
for (let x = 0; x < width; x++) {
|
|
153
|
-
const from = (y * width + x) * stride;
|
|
154
|
-
const to = ((width - 1 - x) * height + y) * stride;
|
|
155
|
-
for (let c = 0; c < stride; c++) {
|
|
156
|
-
rotated[to + c] = data[from + c];
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return rotated;
|
|
161
|
-
};
|
|
162
|
-
ImageDisplayManager.prototype.orientData = function(data, frame, stride) {
|
|
163
|
-
stride = stride || 1;
|
|
164
|
-
return frame.rotate
|
|
165
|
-
? this.rotateCounterclockwise90(data, frame.width, frame.height, stride)
|
|
166
|
-
: data;
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
// Patch 4: parseImageFromBase64(原版,支持动态尺寸 + 旋转)
|
|
170
|
-
ImageDisplayManager.prototype.parseImageFromBase64 = function(base64Input) {
|
|
171
|
-
const binaryString = atob(base64Input.trim());
|
|
172
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
173
|
-
for (let i = 0; i < binaryString.length; i++) {
|
|
174
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
175
|
-
}
|
|
176
|
-
const frame = this.resolveSourceFrame(bytes.length);
|
|
177
|
-
const tempCanvas = document.createElement('canvas');
|
|
178
|
-
tempCanvas.width = frame.width;
|
|
179
|
-
tempCanvas.height = frame.height;
|
|
180
|
-
const tempCtx = tempCanvas.getContext('2d');
|
|
181
|
-
const imageData = tempCtx.createImageData(frame.width, frame.height);
|
|
182
|
-
let minGray = 255, maxGray = 0, sumGray = 0;
|
|
183
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
184
|
-
const gray = bytes[i];
|
|
185
|
-
imageData.data[i * 4] = gray;
|
|
186
|
-
imageData.data[i * 4 + 1] = gray;
|
|
187
|
-
imageData.data[i * 4 + 2] = gray;
|
|
188
|
-
imageData.data[i * 4 + 3] = 255;
|
|
189
|
-
minGray = Math.min(minGray, gray);
|
|
190
|
-
maxGray = Math.max(maxGray, gray);
|
|
191
|
-
sumGray += gray;
|
|
192
|
-
}
|
|
193
|
-
this.currentGrayStats = { min: minGray, max: maxGray };
|
|
194
|
-
const displayFrame = this.getDisplayFrame(frame);
|
|
195
|
-
const displayGray = this.orientData(imageData.data, frame, 4);
|
|
196
|
-
const orientedImageData = new ImageData(displayGray, displayFrame.width, displayFrame.height);
|
|
197
|
-
this.originalImageData = orientedImageData;
|
|
198
|
-
this.canvas.width = orientedImageData.width;
|
|
199
|
-
this.canvas.height = orientedImageData.height;
|
|
200
|
-
return {
|
|
201
|
-
imageData: orientedImageData,
|
|
202
|
-
grayStats: { min: minGray, max: maxGray, avg: parseFloat((sumGray / bytes.length).toFixed(2)) },
|
|
203
|
-
};
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
// Patch 5: parseTemperatureData(原版,支持动态尺寸 + 旋转)
|
|
207
|
-
ImageDisplayManager.prototype.parseTemperatureData = function(base64Input) {
|
|
208
|
-
const binaryString = atob(base64Input.trim());
|
|
209
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
210
|
-
for (let i = 0; i < binaryString.length; i++) {
|
|
211
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
212
|
-
}
|
|
213
|
-
const frame = this.resolveSourceFrame(bytes.length, TEMP_BYTES_PER_PIXEL);
|
|
214
|
-
let floatArray;
|
|
215
|
-
if (frame.bytesPerPixel === 1) {
|
|
216
|
-
floatArray = new Float32Array(bytes.length);
|
|
217
|
-
for (let i = 0; i < bytes.length; i++) floatArray[i] = bytes[i];
|
|
218
|
-
} else if (frame.bytesPerPixel === 4) {
|
|
219
|
-
floatArray = new Float32Array(bytes.buffer);
|
|
220
|
-
} else {
|
|
221
|
-
const float64Array = new Float64Array(bytes.buffer);
|
|
222
|
-
floatArray = new Float32Array(float64Array.length);
|
|
223
|
-
for (let i = 0; i < float64Array.length; i++) floatArray[i] = float64Array[i];
|
|
224
|
-
}
|
|
225
|
-
let minTemp = Infinity, maxTemp = -Infinity, sumTemp = 0;
|
|
226
|
-
for (let i = 0; i < floatArray.length; i++) {
|
|
227
|
-
const t = floatArray[i];
|
|
228
|
-
minTemp = Math.min(minTemp, t);
|
|
229
|
-
maxTemp = Math.max(maxTemp, t);
|
|
230
|
-
sumTemp += t;
|
|
231
|
-
}
|
|
232
|
-
const orientedTemps = this.orientData(floatArray, frame, 1);
|
|
233
|
-
this.temperatureData = orientedTemps;
|
|
234
|
-
const stats = {
|
|
235
|
-
min: parseFloat(minTemp.toFixed(2)),
|
|
236
|
-
max: parseFloat(maxTemp.toFixed(2)),
|
|
237
|
-
avg: parseFloat((sumTemp / floatArray.length).toFixed(2)),
|
|
238
|
-
initValue: parseFloat((minTemp + (maxTemp - minTemp) * 1/3).toFixed(2)),
|
|
239
|
-
};
|
|
240
|
-
this.temperatureStats = stats;
|
|
241
|
-
// 返回 { data, stats } 结构,与调用方期望一致
|
|
242
|
-
return { data: orientedTemps, stats };
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
)
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
(
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
const
|
|
441
|
-
|
|
442
|
-
if (
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
const
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
})
|
|
645
|
-
},
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
},
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
const
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
const
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
},
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
this.
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
if (
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
},
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
if (
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
this.
|
|
1070
|
-
this.
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
this.rectTableData.visible = true;
|
|
1306
|
-
this.rectTableData.typeTitle = this.currentActiveCanvas.btnName;
|
|
1307
|
-
this.rectTableData.infoList = [...this.currentActiveCanvas.cavansRects];
|
|
1308
|
-
this.redrawCanvasWithRectangles();
|
|
1309
|
-
}
|
|
1310
|
-
},
|
|
1311
|
-
drawSelectionRectangle(shape) {
|
|
1312
|
-
const { ctx, canvas, startX, startY, currentX, currentY, scaleFactor } = this.weicaiCanvasDraw;
|
|
1313
|
-
if (canvas.canvasData.bodyFlag !== this.currentActiveCanvas.bodyFlag) return;
|
|
1314
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
1315
|
-
let { wwValue: grayWW, wlValue: tempWL } = canvas.canvasData;
|
|
1316
|
-
if (canvas.canvasData && canvas.canvasData.imageData) {
|
|
1317
|
-
this.upDateDisplay({ grayWW: Number(grayWW) * 10, tempWL, canvasData: canvas.canvasData });
|
|
1318
|
-
}
|
|
1319
|
-
this.drawExistingRectangles(ctx, canvas);
|
|
1320
|
-
if (!this.weicaiCanvasDraw.isDrawing) return;
|
|
1321
|
-
const rectInfo = canvasUtils.drawSelectionRectangle(ctx, {
|
|
1322
|
-
startX, startY, currentX, currentY, scaleFactor,
|
|
1323
|
-
canvasWidth: canvas.width, canvasHeight: canvas.height,
|
|
1324
|
-
strokeColor: this.red1Mode ? "#ffffff" : "#000000",
|
|
1325
|
-
shape: shape || this.measureToolShape,
|
|
1326
|
-
});
|
|
1327
|
-
this.weicaiCanvasDraw.currentRect = rectInfo;
|
|
1328
|
-
},
|
|
1329
|
-
deleteRectFromList(rectItem) {
|
|
1330
|
-
const result = canvasUtils.deleteRectangleById(this.currentActiveCanvas.cavansRects, rectItem.id);
|
|
1331
|
-
this.resetCanvasCursor(this.currentActiveCanvas.canvas);
|
|
1332
|
-
if (result.success) {
|
|
1333
|
-
const button = document.getElementById(`delete-btn-${rectItem.id}`);
|
|
1334
|
-
if (button) button.remove();
|
|
1335
|
-
this.currentActiveCanvas.cavansRects = result.updatedRectangles;
|
|
1336
|
-
this.rectTableData.infoList = this.currentActiveCanvas.cavansRects;
|
|
1337
|
-
this.selectedRectId = null;
|
|
1338
|
-
if (this.currentActiveCanvas.cavansRects.length === 0) this.rectTableData.visible = false;
|
|
1339
|
-
this.redrawCanvasWithRectangles();
|
|
1340
|
-
}
|
|
1341
|
-
},
|
|
1342
|
-
drawExistingRectangles(ctx, canvas) {
|
|
1343
|
-
if (!this.currentActiveCanvas.cavansRects || this.currentActiveCanvas.cavansRects.length === 0) return;
|
|
1344
|
-
const rectStyle = {
|
|
1345
|
-
strokeColor: this.red1Mode ? "#ffffff" : "#000000",
|
|
1346
|
-
textColor: this.red1Mode ? "#ffffff" : "#000000",
|
|
1347
|
-
selectedId: this.selectedRectId,
|
|
1348
|
-
};
|
|
1349
|
-
const updatedRectangles = canvasUtils.drawExistingRectangles(ctx, canvas, this.currentActiveCanvas.cavansRects, rectStyle);
|
|
1350
|
-
this.currentActiveCanvas.cavansRects = updatedRectangles.map((rect, index) => ({
|
|
1351
|
-
...this.currentActiveCanvas.cavansRects[index], _renderInfo: rect._renderInfo,
|
|
1352
|
-
}));
|
|
1353
|
-
this.syncSelectedDeleteButton();
|
|
1354
|
-
},
|
|
1355
|
-
selectMeasureTool(shape) {
|
|
1356
|
-
if (this.measureToolActive && this.measureToolShape === shape) {
|
|
1357
|
-
this.measureToolActive = false;
|
|
1358
|
-
} else {
|
|
1359
|
-
this.measureToolActive = true;
|
|
1360
|
-
this.measureToolShape = shape;
|
|
1361
|
-
}
|
|
1362
|
-
},
|
|
1363
|
-
closeRectInfoList() { this.rectTableData.visible = false; },
|
|
1364
|
-
resetRectPanel() {
|
|
1365
|
-
if (this.rectTableData.visible && this.$refs.rectPanel) {
|
|
1366
|
-
this.$refs.rectPanel.resetPosition();
|
|
1367
|
-
return;
|
|
1368
|
-
}
|
|
1369
|
-
this.rectTableData.visible = true;
|
|
1370
|
-
this.$nextTick(() => { if (this.$refs.rectPanel) this.$refs.rectPanel.resetPosition(); });
|
|
1371
|
-
},
|
|
1372
|
-
clearAllMeasurements() {
|
|
1373
|
-
this.selectedRectId = null;
|
|
1374
|
-
canvasUtils.removeAllDOMDeleteButtons();
|
|
1375
|
-
Object.keys(this.canvasList).forEach((bodyFlag) => {
|
|
1376
|
-
const item = this.canvasList[bodyFlag];
|
|
1377
|
-
if (!item) return;
|
|
1378
|
-
item.cavansRects = [];
|
|
1379
|
-
const ref = this.$refs['resultCanvas_' + bodyFlag];
|
|
1380
|
-
const canvas = ref && ref[0];
|
|
1381
|
-
if (canvas) {
|
|
1382
|
-
canvas.style.cursor = '';
|
|
1383
|
-
const dm = item.rightDisplayManager || item.displayManager;
|
|
1384
|
-
if (dm) dm.updateDisplay(item);
|
|
1385
|
-
}
|
|
1386
|
-
});
|
|
1387
|
-
this.rectTableData.infoList = [];
|
|
1388
|
-
this.rectTableData.visible = false;
|
|
1389
|
-
},
|
|
1390
|
-
redrawCanvasWithRectangles() {
|
|
1391
|
-
if (this.currentActiveCanvas && this.currentActiveCanvas.bodyFlag) {
|
|
1392
|
-
this.$nextTick(() => {
|
|
1393
|
-
const canvasRef = this.$refs['resultCanvas_' + this.currentActiveCanvas.bodyFlag];
|
|
1394
|
-
if (canvasRef && canvasRef[0]) {
|
|
1395
|
-
const canvas = canvasRef[0];
|
|
1396
|
-
const ctx = canvas.getContext('2d');
|
|
1397
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
1398
|
-
let { canvasData } = canvas;
|
|
1399
|
-
if (canvas.canvasData && canvas.canvasData.imageData) {
|
|
1400
|
-
// 优先用 rightDisplayManager(右侧大 canvas 的 manager),
|
|
1401
|
-
// 因为 canvasUtils.drawExistingRectangles 是画到 canvas 参数(右侧大 canvas)上,
|
|
1402
|
-
// 而 updateDisplay 必须也画到同一个 canvas 才对
|
|
1403
|
-
const dm = canvasData.rightDisplayManager || canvasData.displayManager;
|
|
1404
|
-
if (dm) dm.updateDisplay(canvasData);
|
|
1405
|
-
}
|
|
1406
|
-
this.drawExistingRectangles(ctx, canvas);
|
|
1407
|
-
}
|
|
1408
|
-
});
|
|
1409
|
-
}
|
|
1410
|
-
},
|
|
1411
|
-
getSelectedRegionData() {
|
|
1412
|
-
let canvas = this.weicaiCanvasDraw.canvas;
|
|
1413
|
-
let temperatureData = this.weicaiCanvasDraw.canvas.tempData;
|
|
1414
|
-
if (!temperatureData) return [];
|
|
1415
|
-
return canvasUtils.extractRegionData(
|
|
1416
|
-
temperatureData,
|
|
1417
|
-
this.weicaiCanvasDraw.startX, this.weicaiCanvasDraw.startY,
|
|
1418
|
-
this.weicaiCanvasDraw.currentX, this.weicaiCanvasDraw.currentY,
|
|
1419
|
-
canvas.width, canvas.height,
|
|
1420
|
-
);
|
|
1421
|
-
},
|
|
1422
|
-
addRectangleToList() {
|
|
1423
|
-
const rectCount = this.currentActiveCanvas.cavansRects ? this.currentActiveCanvas.cavansRects.length + 1 : 1;
|
|
1424
|
-
const newRect = canvasUtils.createRectangle({
|
|
1425
|
-
startX: this.cavansRect.startX, startY: this.cavansRect.startY,
|
|
1426
|
-
endX: this.cavansRect.endX, endY: this.cavansRect.endY,
|
|
1427
|
-
width: this.cavansRect.width, height: this.cavansRect.height,
|
|
1428
|
-
regionAvgTemp: this.cavansRect.regionAvgTemp,
|
|
1429
|
-
regionMaxTemp: this.cavansRect.regionMaxTemp,
|
|
1430
|
-
regionMinTemp: this.cavansRect.regionMinTemp,
|
|
1431
|
-
regionVariance: this.cavansRect.regionVariance,
|
|
1432
|
-
}, rectCount);
|
|
1433
|
-
if (!this.currentActiveCanvas.cavansRects) this.currentActiveCanvas.cavansRects = [];
|
|
1434
|
-
this.currentActiveCanvas.cavansRects.push(newRect);
|
|
1435
|
-
this.rectTableData.visible = true;
|
|
1436
|
-
this.rectTableData.typeTitle = this.currentActiveCanvas.btnName;
|
|
1437
|
-
this.rectTableData.infoList = [...this.currentActiveCanvas.cavansRects];
|
|
1438
|
-
},
|
|
1439
|
-
calculateStats(regionData) {
|
|
1440
|
-
const stats = canvasUtils.calculateStats(regionData);
|
|
1441
|
-
if (stats) {
|
|
1442
|
-
this.cavansRect.regionAvgTemp = stats.regionAvgTemp;
|
|
1443
|
-
this.cavansRect.regionMaxTemp = stats.regionMaxTemp;
|
|
1444
|
-
this.cavansRect.regionMinTemp = stats.regionMinTemp;
|
|
1445
|
-
this.cavansRect.regionVariance = stats.regionVariance;
|
|
1446
|
-
}
|
|
1447
|
-
},
|
|
1448
|
-
handleBeforeClose() { this.imageDialog = false; },
|
|
1449
|
-
handleDialogClosed() {
|
|
1450
|
-
canvasUtils.removeAllDOMDeleteButtons();
|
|
1451
|
-
this.$emit("closedDialog");
|
|
1452
|
-
},
|
|
1453
|
-
},
|
|
1454
|
-
mounted() {
|
|
1455
|
-
this.imageQueue = new ImageQueue(2);
|
|
1456
|
-
this._bodyOverflow = document.body.style.overflow;
|
|
1457
|
-
this._htmlOverflow = document.documentElement.style.overflow;
|
|
1458
|
-
document.body.style.overflow = 'hidden';
|
|
1459
|
-
document.documentElement.style.overflow = 'hidden';
|
|
1460
|
-
document.body.style.margin = '0';
|
|
1461
|
-
document.documentElement.style.margin = '0';
|
|
1462
|
-
},
|
|
1463
|
-
beforeDestroy() {
|
|
1464
|
-
if (document.body) {
|
|
1465
|
-
document.body.style.overflow = this._bodyOverflow || '';
|
|
1466
|
-
document.body.style.margin = '';
|
|
1467
|
-
}
|
|
1468
|
-
if (document.documentElement) {
|
|
1469
|
-
document.documentElement.style.overflow = this._htmlOverflow || '';
|
|
1470
|
-
document.documentElement.style.margin = '';
|
|
1471
|
-
}
|
|
1472
|
-
},
|
|
1473
|
-
};
|
|
1474
|
-
</script>
|
|
1475
|
-
|
|
1476
|
-
<style lang="less" scoped>
|
|
1477
|
-
* { box-sizing: border-box !important; }
|
|
1478
|
-
|
|
1479
|
-
.closed {
|
|
1480
|
-
width: 40px; height: 40px; line-height: 38px;
|
|
1481
|
-
border-radius: 50%; font-size: 40px; text-align: center;
|
|
1482
|
-
position: absolute; top: 10px; right: 20px; z-index: 20;
|
|
1483
|
-
color: #409eff; cursor: pointer;
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
.container {
|
|
1487
|
-
position: fixed; top: 0; left: 0; right: 0; bottom: 0;
|
|
1488
|
-
display: flex; flex-direction: column; margin: 0;
|
|
1489
|
-
padding-top: 0; box-sizing: border-box; overflow: hidden;
|
|
1490
|
-
background: #f4f6fa; z-index: 1; pointer-events: auto;
|
|
1491
|
-
}
|
|
1492
|
-
|
|
1493
|
-
.title {
|
|
1494
|
-
flex: none; width: 100%; height: 26px;
|
|
1495
|
-
font-family: SimSun, 宋体; font-size: 12px; font-weight: bold;
|
|
1496
|
-
line-height: 26px; text-align: center; color: #ffffff;
|
|
1497
|
-
background: #95adc8; box-sizing: border-box;
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
.stats-container { flex: none; min-height: 0; height: auto; margin: 0; }
|
|
1501
|
-
|
|
1502
|
-
.color-img {
|
|
1503
|
-
position: relative; width: 100%; height: 100%;
|
|
1504
|
-
margin-right: 5px; display: flex; flex-direction: column;
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
.delete-btn {
|
|
1508
|
-
position: absolute; background: rgba(255, 0, 0, 0.7); color: white;
|
|
1509
|
-
border: none; border-radius: 3px; width: 40px; height: 20px;
|
|
1510
|
-
display: flex; align-items: center; justify-content: center;
|
|
1511
|
-
cursor: pointer; font-size: 30px; font-weight: bold; pointer-events: auto; box-sizing: border-box;
|
|
1512
|
-
}
|
|
1513
|
-
.delete-btn:hover { background: rgba(255, 0, 0, 1); }
|
|
1514
|
-
|
|
1515
|
-
.right-area { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
|
|
1516
|
-
|
|
1517
|
-
.red1-switch {
|
|
1518
|
-
flex: none; min-height: 56px; padding: 6px 4px 8px;
|
|
1519
|
-
display: flex; align-items: center; gap: 12px;
|
|
1520
|
-
box-sizing: border-box; text-align: left;
|
|
1521
|
-
font-size: 16px; font-weight: 800; letter-spacing: 2px; color: #1f2937;
|
|
1522
|
-
|
|
1523
|
-
.user-info-item {
|
|
1524
|
-
font-size: 14px; font-weight: normal; letter-spacing: normal; color: #303133;
|
|
1525
|
-
em { font-style: normal; color: #909399; margin-right: 2px; }
|
|
1526
|
-
}
|
|
1527
|
-
.measure-tool-group {
|
|
1528
|
-
display: inline-flex; align-items: center; gap: 4px;
|
|
1529
|
-
background: #f5f7fa; border: 1px solid #dcdfe6; border-radius: 6px; padding: 3px 5px;
|
|
1530
|
-
.mtg-label { font-size: 13px; color: #606266; margin-right: 2px; font-weight: 600; }
|
|
1531
|
-
.mtg-btn {
|
|
1532
|
-
width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
|
|
1533
|
-
border: 1px solid transparent; background: transparent; border-radius: 4px;
|
|
1534
|
-
cursor: pointer; font-size: 16px; color: #606266; padding: 0; transition: all 0.15s; line-height: 1;
|
|
1535
|
-
&:hover { color: #409eff; }
|
|
1536
|
-
&.active {
|
|
1537
|
-
background: #409eff; color: #ffffff; border-color: #409eff;
|
|
1538
|
-
box-shadow: 0 2px 4px rgba(64, 158, 255, 0.3);
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1542
|
-
.reset-panel-btn { font-size: 12px; font-weight: 600; padding: 8px 12px; height: auto; }
|
|
1543
|
-
::v-deep .el-checkbox__label { font-size: 17px; font-weight: 900; letter-spacing: 2px; padding-left: 8px; }
|
|
1544
|
-
::v-deep .el-checkbox__inner { width: 22px; height: 22px; }
|
|
1545
|
-
::v-deep .el-checkbox__input.is-checked .el-checkbox__inner::after { width: 10px; height: 6px; }
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
.body-container {
|
|
1549
|
-
flex: 1; min-height: 0; margin: 0; width: 100%; padding: 12px;
|
|
1550
|
-
box-sizing: border-box; overflow: hidden; display: flex; gap: 12px;
|
|
1551
|
-
|
|
1552
|
-
.init-pic {
|
|
1553
|
-
flex: 0 0 30%; min-height: 0; max-height: 100%; overflow: hidden;
|
|
1554
|
-
text-align: center; padding: 10px; padding-bottom: 0; box-sizing: border-box;
|
|
1555
|
-
background: #fff; border: 1px solid #dcdfe6; border-radius: 8px;
|
|
1556
|
-
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04); position: relative;
|
|
1557
|
-
display: flex; flex-direction: column;
|
|
1558
|
-
&::-webkit-scrollbar { width: 6px; }
|
|
1559
|
-
&::-webkit-scrollbar-track { background: transparent; }
|
|
1560
|
-
&::-webkit-scrollbar-thumb { background: #c8d1dc; border-radius: 3px; }
|
|
1561
|
-
&::-webkit-scrollbar-thumb:hover { background: #a0b0c2; }
|
|
1562
|
-
scrollbar-width: thin; scrollbar-color: #c8d1dc transparent;
|
|
1563
|
-
|
|
1564
|
-
.inputContainer {
|
|
1565
|
-
flex: none; width: 100%; padding: 10px 10px; margin-top: 8px;
|
|
1566
|
-
background: #EFF6FF; box-sizing: border-box;
|
|
1567
|
-
.window-row {
|
|
1568
|
-
flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 3px 0;
|
|
1569
|
-
.row-label { flex: none; font-size: 16px; line-height: 1; color: #2563EB; white-space: nowrap; }
|
|
1570
|
-
.row-value { flex: none; min-width: 48px; font-size: 18px; font-variant-numeric: tabular-nums; line-height: 1.8; text-align: left; color: #2563EB; }
|
|
1571
|
-
.row-container { width: 100%; display: flex; background: #fff;
|
|
1572
|
-
.row-btn {
|
|
1573
|
-
flex: none; width: 14px; height: 22px; padding: 0; font-size: 26px; line-height: 22px;
|
|
1574
|
-
font-weight: 700; text-align: center; color: #303133; background: transparent; border: none; cursor: pointer; transition: color 0.2s;
|
|
1575
|
-
&:hover { color: #409eff; } &:active { color: #1f7ad0; }
|
|
1576
|
-
}
|
|
1577
|
-
.row-scale {
|
|
1578
|
-
flex: 1; min-width: 40px; height: 22px; padding: 0 6px; box-sizing: border-box;
|
|
1579
|
-
display: flex; align-items: center; cursor: ew-resize; touch-action: none; user-select: none;
|
|
1580
|
-
.row-rail { position: relative; width: 100%; height: 2px; border-radius: 1px; background: #c9d4de;
|
|
1581
|
-
.row-fill { position: absolute; top: 0; left: 0; height: 100%; background: transparent; }
|
|
1582
|
-
.row-thumb {
|
|
1583
|
-
position: absolute; top: 50%; width: 18px; height: 23px; margin-left: -5px;
|
|
1584
|
-
border: none; border-radius: 2px; background: rgba(120, 140, 160, 0.8); transform: translateY(-50%);
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
|
|
1592
|
-
.img-container {
|
|
1593
|
-
flex: 1; min-height: 0; width: 100%; padding: 5px; margin: 0; box-sizing: border-box;
|
|
1594
|
-
display: flex; flex-wrap: wrap; justify-content: space-between;
|
|
1595
|
-
overflow-y: auto; overflow-x: hidden; align-content: flex-start;
|
|
1596
|
-
&::-webkit-scrollbar { width: 6px; }
|
|
1597
|
-
&::-webkit-scrollbar-track { background: transparent; }
|
|
1598
|
-
&::-webkit-scrollbar-thumb { background: #c8d1dc; border-radius: 3px; }
|
|
1599
|
-
&::-webkit-scrollbar-thumb:hover { background: #a0b0c2; }
|
|
1600
|
-
scrollbar-width: thin; scrollbar-color: #c8d1dc transparent;
|
|
1601
|
-
|
|
1602
|
-
.pic-item {
|
|
1603
|
-
width: 49%; min-height: 200px; max-height: 350px;
|
|
1604
|
-
.img-item {
|
|
1605
|
-
width: 100%; position: relative;
|
|
1606
|
-
.activeCanvas {
|
|
1607
|
-
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
|
|
1608
|
-
box-sizing: border-box; background: rgba(64, 158, 255, 0.12);
|
|
1609
|
-
border: 2px solid #409eff; pointer-events: none; z-index: 2;
|
|
1610
|
-
}
|
|
1611
|
-
.imgClass { width: 100%; }
|
|
1612
|
-
}
|
|
1613
|
-
.picText {
|
|
1614
|
-
width: 100px; height: 32px; line-height: 32px; margin: 10px auto 4px;
|
|
1615
|
-
font-size: 13px; color: #606266; background: #fff;
|
|
1616
|
-
border: 1px solid #dcdfe6; border-radius: 4px;
|
|
1617
|
-
}
|
|
1618
|
-
.active { color: #fff; background: #409eff; border-color: #409eff; }
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
.color-map {
|
|
1624
|
-
flex: 1; min-width: 0; min-height: 0; display: flex; overflow: hidden;
|
|
1625
|
-
padding: 8px; box-sizing: border-box; background: #fff;
|
|
1626
|
-
.color-item {
|
|
1627
|
-
flex: 1; min-width: 0; height: 100%; display: flex; justify-content: space-between;
|
|
1628
|
-
.color-img {
|
|
1629
|
-
flex: 1; min-width: 0; width: 100%;
|
|
1630
|
-
img { width: 100%; height: 100%; margin-right: 50px; }
|
|
1631
|
-
.tempBtn1 { position: absolute; left: 0; right: 0; bottom: -40px; text-align: center; }
|
|
1632
|
-
.tempBtn2 { position: absolute; left: 60%; right: 0px; bottom: -40px; text-align: center; }
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
::v-deep element.style { max-width: 600px !important; }
|
|
1639
|
-
|
|
1640
|
-
.floating-temp {
|
|
1641
|
-
position: absolute; padding: 5px 10px; background-color: rgba(0, 0, 0, 0.7);
|
|
1642
|
-
color: white; display: none; border-radius: 4px; font-size: 14px;
|
|
1643
|
-
pointer-events: none; z-index: 88; white-space: nowrap;
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
.color-body { position: relative; flex: 1; min-height: 0; background: #000; }
|
|
1647
|
-
|
|
1648
|
-
.canvas-item {
|
|
1649
|
-
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
|
|
1650
|
-
display: block; border: none; will-change: transform; object-fit: contain;
|
|
1651
|
-
}
|
|
1652
|
-
.canvas-item.active-canvas { outline: 2px solid #409eff; outline-offset: -2px; }
|
|
1653
|
-
|
|
1654
|
-
.placeholder-image {
|
|
1655
|
-
position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain;
|
|
1656
|
-
}
|
|
1657
|
-
|
|
1658
|
-
.color-img {
|
|
1659
|
-
display: flex; flex-direction: column; flex: 1; min-height: 0;
|
|
1660
|
-
position: relative; width: 100%; height: 100%; margin-right: 5px;
|
|
1661
|
-
background: #ffffff; border: 1px solid #d9d9d9; box-sizing: border-box; overflow: hidden;
|
|
1662
|
-
&.is-active { border-color: #409eff; .title { background: #409eff; } }
|
|
1663
|
-
}
|
|
1664
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog fullscreen :show-header="false" :visible.sync="imageDialog" @closed="handleDialogClosed">
|
|
3
|
+
<div class="closed" @click="handleBeforeClose"><i class="el-icon-circle-close"></i></div>
|
|
4
|
+
<div class="container">
|
|
5
|
+
<div class="stats-container">
|
|
6
|
+
<RectInfo ref="rectPanel" v-if="rectTableData.visible" :rectTableData="rectTableData"
|
|
7
|
+
@closeRectInfoList="closeRectInfoList" @deleteRectFromList="deleteRectFromList"
|
|
8
|
+
@clearAllMeasurements="clearAllMeasurements"></RectInfo>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div class="body-container" ref="parent">
|
|
12
|
+
<!-- 缩略图(部位列表) -->
|
|
13
|
+
<div class="init-pic">
|
|
14
|
+
<div class="img-container">
|
|
15
|
+
<div class="pic-item" v-for="item in canvasList" :key="item.bodyFlag">
|
|
16
|
+
<div class="img-item" :ref="'imgItem' + item.bodyFlag" @click="clickGary(item)">
|
|
17
|
+
<div :class="flag == item.bodyFlag ? 'activeCanvas' : ''"></div>
|
|
18
|
+
<img v-if="!item.imgName" class="imgClass" :src="defaultImage" alt="" />
|
|
19
|
+
<canvas v-else :id="'resultCanvas' + item.bodyFlag" :ref="'resultCanvas' + item.bodyFlag"
|
|
20
|
+
class="img-item"></canvas>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="picText" :class="flag == item.bodyFlag ? 'active' : ''">{{ item.btnName }}</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="inputContainer">
|
|
26
|
+
<div class="window-row">
|
|
27
|
+
<span class="row-label">温窗起点</span>
|
|
28
|
+
<span class="row-value">{{ wlText }}</span>
|
|
29
|
+
<div class="row-container">
|
|
30
|
+
<button class="row-btn" @click="stepWl(-0.1)">‹</button>
|
|
31
|
+
<div class="row-scale" @pointerdown="onScaleDown($event, 'wl')">
|
|
32
|
+
<div class="row-rail">
|
|
33
|
+
<span class="row-fill" :style="{ width: wlPct + '%' }"></span>
|
|
34
|
+
<div class="row-thumb" :style="{ left: wlPct + '%' }"></div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<button class="row-btn" @click="stepWl(0.1)">›</button>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="window-row">
|
|
41
|
+
<span class="row-label">温窗宽度</span>
|
|
42
|
+
<span class="row-value">{{ wwText }}</span>
|
|
43
|
+
<div class="row-container">
|
|
44
|
+
<button class="row-btn" @click="stepWw(-0.5)">‹</button>
|
|
45
|
+
<div class="row-scale" @pointerdown="onScaleDown($event, 'ww')">
|
|
46
|
+
<div class="row-rail">
|
|
47
|
+
<span class="row-fill" :style="{ width: wwPct + '%' }"></span>
|
|
48
|
+
<div class="row-thumb" :style="{ left: wwPct + '%' }"></div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<button class="row-btn" @click="stepWw(0.5)">›</button>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
<!-- 右侧区域:工具条 + 两个 canvas 画布 -->
|
|
57
|
+
<div class="right-area">
|
|
58
|
+
<div class="red1-switch">
|
|
59
|
+
<!-- 用户信息(与切换图像同一行,左右排列) -->
|
|
60
|
+
<span class="user-info-item"><em>姓名:</em>{{ currentUserInfo.userName }}</span>
|
|
61
|
+
<span class="user-info-item"><em>性别:</em>{{ currentUserInfo.userSex }}</span>
|
|
62
|
+
<span class="user-info-item"><em>手机号:</em>{{ currentUserInfo.userPhone }}</span>
|
|
63
|
+
<el-checkbox border v-model="red1Mode" icon-size="40px" @change="onRed1Change">切换图像</el-checkbox>
|
|
64
|
+
<div class="measure-tool-group">
|
|
65
|
+
<span class="mtg-label">测温工具:</span>
|
|
66
|
+
<button class="mtg-btn"
|
|
67
|
+
:class="{ active: measureToolActive && measureToolShape === 'point' }" @click="selectMeasureTool('point')"
|
|
68
|
+
title="点测温">⌖</button>
|
|
69
|
+
<button class="mtg-btn"
|
|
70
|
+
:class="{ active: measureToolActive && measureToolShape === 'rect' }" @click="selectMeasureTool('rect')"
|
|
71
|
+
title="方框测温">▢</button>
|
|
72
|
+
<button class="mtg-btn"
|
|
73
|
+
:class="{ active: measureToolActive && measureToolShape === 'circle' }"
|
|
74
|
+
@click="selectMeasureTool('circle')" title="圆形测温">◯</button>
|
|
75
|
+
</div>
|
|
76
|
+
<el-button v-show="rectTableData.infoList.length > 0" class="reset-panel-btn" size="mini"
|
|
77
|
+
icon="el-icon-refresh" @click="resetRectPanel">还原弹框</el-button>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="color-map">
|
|
80
|
+
<div class="color-item" v-for="(item, idx) in thumbnailList" :key="item.bodyFlag"
|
|
81
|
+
@click="switchRightCanvas(item)">
|
|
82
|
+
<div class="color-img" :ref="'colorImgItem' + item.bodyFlag"
|
|
83
|
+
:class="{ 'is-active': item.bodyFlag === currentActiveCanvas.bodyFlag }">
|
|
84
|
+
<div class="title" :id="'title' + item.bodyFlag" :ref="'title' + item.bodyFlag">
|
|
85
|
+
<div v-if="item.btnName">{{ item.btnName }}</div>
|
|
86
|
+
</div>
|
|
87
|
+
<div class="color-body">
|
|
88
|
+
<img v-if="!item.imgName" :src="defaultImage" class="placeholder-image" />
|
|
89
|
+
<canvas v-else :id="'resultCanvas_' + item.bodyFlag" :ref="'resultCanvas_' + item.bodyFlag"
|
|
90
|
+
@wheel.prevent="handleScroll"
|
|
91
|
+
:class="['canvas-item', { 'active-canvas': item.bodyFlag === currentActiveCanvas.bodyFlag }]"></canvas>
|
|
92
|
+
<div class="floating-temp"></div>
|
|
93
|
+
</div>
|
|
94
|
+
<div :class="item.id == 1 ? 'tempBtn1' : 'tempBtn2'" v-if="item.buttonName">
|
|
95
|
+
<el-button style="height: 40px" type="primary" @click="processImage">{{ item.buttonName }}</el-button>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
<div>
|
|
102
|
+
<canvas style="display: none" id="processedCanvas" ref="processedCanvas"></canvas>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</el-dialog>
|
|
107
|
+
</template>
|
|
108
|
+
|
|
109
|
+
<script>
|
|
110
|
+
import { MedicalColorProcessor, ImageDisplayManager, WindowLevelController, canvasUtils, ImageQueue } from '@duyafeng/pseudocolor/legacy/pseudoColor';
|
|
111
|
+
import RectInfo from './Rect.vue';
|
|
112
|
+
import { getDefaultPositions } from './positionPresets.js';
|
|
113
|
+
|
|
114
|
+
// ══════════════════════════════════════════════════════════════
|
|
115
|
+
// Monkey-patches for @duyafeng/pseudocolor legacy ImageDisplayManager
|
|
116
|
+
// legacy 版硬编码 288×384,原版动态匹配 256×192 / 288×384 + 旋转处理
|
|
117
|
+
// ══════════════════════════════════════════════════════════════
|
|
118
|
+
const CANDIDATE_FRAMES = [
|
|
119
|
+
{ width: 256, height: 192, rotate: true },
|
|
120
|
+
{ width: 288, height: 384, rotate: false },
|
|
121
|
+
];
|
|
122
|
+
const TEMP_BYTES_PER_PIXEL = [1, 4, 8];
|
|
123
|
+
|
|
124
|
+
// Patch 1: 缺 setRed1Mode
|
|
125
|
+
ImageDisplayManager.prototype.setRed1Mode = function(mode) {
|
|
126
|
+
this.red1Mode = !!mode;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// Patch 2: 动态匹配帧尺寸(256×192 / 288×384)
|
|
130
|
+
ImageDisplayManager.prototype.resolveSourceFrame = function(byteLength, bytesPerPixelList) {
|
|
131
|
+
bytesPerPixelList = bytesPerPixelList || [1];
|
|
132
|
+
for (const bytesPerPixel of bytesPerPixelList) {
|
|
133
|
+
for (const frame of CANDIDATE_FRAMES) {
|
|
134
|
+
if (byteLength === frame.width * frame.height * bytesPerPixel) {
|
|
135
|
+
return { ...frame, bytesPerPixel };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
throw new Error(
|
|
140
|
+
`数据长度不匹配!检测到 ${byteLength} 字节,预期尺寸 ${CANDIDATE_FRAMES.map(f => `${f.width}×${f.height}`).join(' 或 ')}、单像素 ${bytesPerPixelList.join('/')} 字节`
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// Patch 3: 旋转相关(256×192 需逆时针旋转 90°)
|
|
145
|
+
ImageDisplayManager.prototype.getDisplayFrame = function({ width, height, rotate }) {
|
|
146
|
+
return rotate ? { width: height, height: width } : { width, height };
|
|
147
|
+
};
|
|
148
|
+
ImageDisplayManager.prototype.rotateCounterclockwise90 = function(data, width, height, stride) {
|
|
149
|
+
stride = stride || 1;
|
|
150
|
+
const rotated = new data.constructor(data.length);
|
|
151
|
+
for (let y = 0; y < height; y++) {
|
|
152
|
+
for (let x = 0; x < width; x++) {
|
|
153
|
+
const from = (y * width + x) * stride;
|
|
154
|
+
const to = ((width - 1 - x) * height + y) * stride;
|
|
155
|
+
for (let c = 0; c < stride; c++) {
|
|
156
|
+
rotated[to + c] = data[from + c];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return rotated;
|
|
161
|
+
};
|
|
162
|
+
ImageDisplayManager.prototype.orientData = function(data, frame, stride) {
|
|
163
|
+
stride = stride || 1;
|
|
164
|
+
return frame.rotate
|
|
165
|
+
? this.rotateCounterclockwise90(data, frame.width, frame.height, stride)
|
|
166
|
+
: data;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
// Patch 4: parseImageFromBase64(原版,支持动态尺寸 + 旋转)
|
|
170
|
+
ImageDisplayManager.prototype.parseImageFromBase64 = function(base64Input) {
|
|
171
|
+
const binaryString = atob(base64Input.trim());
|
|
172
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
173
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
174
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
175
|
+
}
|
|
176
|
+
const frame = this.resolveSourceFrame(bytes.length);
|
|
177
|
+
const tempCanvas = document.createElement('canvas');
|
|
178
|
+
tempCanvas.width = frame.width;
|
|
179
|
+
tempCanvas.height = frame.height;
|
|
180
|
+
const tempCtx = tempCanvas.getContext('2d');
|
|
181
|
+
const imageData = tempCtx.createImageData(frame.width, frame.height);
|
|
182
|
+
let minGray = 255, maxGray = 0, sumGray = 0;
|
|
183
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
184
|
+
const gray = bytes[i];
|
|
185
|
+
imageData.data[i * 4] = gray;
|
|
186
|
+
imageData.data[i * 4 + 1] = gray;
|
|
187
|
+
imageData.data[i * 4 + 2] = gray;
|
|
188
|
+
imageData.data[i * 4 + 3] = 255;
|
|
189
|
+
minGray = Math.min(minGray, gray);
|
|
190
|
+
maxGray = Math.max(maxGray, gray);
|
|
191
|
+
sumGray += gray;
|
|
192
|
+
}
|
|
193
|
+
this.currentGrayStats = { min: minGray, max: maxGray };
|
|
194
|
+
const displayFrame = this.getDisplayFrame(frame);
|
|
195
|
+
const displayGray = this.orientData(imageData.data, frame, 4);
|
|
196
|
+
const orientedImageData = new ImageData(displayGray, displayFrame.width, displayFrame.height);
|
|
197
|
+
this.originalImageData = orientedImageData;
|
|
198
|
+
this.canvas.width = orientedImageData.width;
|
|
199
|
+
this.canvas.height = orientedImageData.height;
|
|
200
|
+
return {
|
|
201
|
+
imageData: orientedImageData,
|
|
202
|
+
grayStats: { min: minGray, max: maxGray, avg: parseFloat((sumGray / bytes.length).toFixed(2)) },
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// Patch 5: parseTemperatureData(原版,支持动态尺寸 + 旋转)
|
|
207
|
+
ImageDisplayManager.prototype.parseTemperatureData = function(base64Input) {
|
|
208
|
+
const binaryString = atob(base64Input.trim());
|
|
209
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
210
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
211
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
212
|
+
}
|
|
213
|
+
const frame = this.resolveSourceFrame(bytes.length, TEMP_BYTES_PER_PIXEL);
|
|
214
|
+
let floatArray;
|
|
215
|
+
if (frame.bytesPerPixel === 1) {
|
|
216
|
+
floatArray = new Float32Array(bytes.length);
|
|
217
|
+
for (let i = 0; i < bytes.length; i++) floatArray[i] = bytes[i];
|
|
218
|
+
} else if (frame.bytesPerPixel === 4) {
|
|
219
|
+
floatArray = new Float32Array(bytes.buffer);
|
|
220
|
+
} else {
|
|
221
|
+
const float64Array = new Float64Array(bytes.buffer);
|
|
222
|
+
floatArray = new Float32Array(float64Array.length);
|
|
223
|
+
for (let i = 0; i < float64Array.length; i++) floatArray[i] = float64Array[i];
|
|
224
|
+
}
|
|
225
|
+
let minTemp = Infinity, maxTemp = -Infinity, sumTemp = 0;
|
|
226
|
+
for (let i = 0; i < floatArray.length; i++) {
|
|
227
|
+
const t = floatArray[i];
|
|
228
|
+
minTemp = Math.min(minTemp, t);
|
|
229
|
+
maxTemp = Math.max(maxTemp, t);
|
|
230
|
+
sumTemp += t;
|
|
231
|
+
}
|
|
232
|
+
const orientedTemps = this.orientData(floatArray, frame, 1);
|
|
233
|
+
this.temperatureData = orientedTemps;
|
|
234
|
+
const stats = {
|
|
235
|
+
min: parseFloat(minTemp.toFixed(2)),
|
|
236
|
+
max: parseFloat(maxTemp.toFixed(2)),
|
|
237
|
+
avg: parseFloat((sumTemp / floatArray.length).toFixed(2)),
|
|
238
|
+
initValue: parseFloat((minTemp + (maxTemp - minTemp) * 1/3).toFixed(2)),
|
|
239
|
+
};
|
|
240
|
+
this.temperatureStats = stats;
|
|
241
|
+
// 返回 { data, stats } 结构,与调用方期望一致
|
|
242
|
+
return { data: orientedTemps, stats };
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export default {
|
|
246
|
+
name: 'PseudoColorViewer',
|
|
247
|
+
components: { RectInfo },
|
|
248
|
+
props: {
|
|
249
|
+
/**
|
|
250
|
+
* 接口获取函数(必填)
|
|
251
|
+
* 签名:async ({ orderCheckId, currentNumber }) => { code, data: [{ gray, temp, flag }] }
|
|
252
|
+
* 返回字段名通过 dataMap prop 映射
|
|
253
|
+
*/
|
|
254
|
+
fetchImage: {
|
|
255
|
+
type: Function,
|
|
256
|
+
required: true,
|
|
257
|
+
},
|
|
258
|
+
/**
|
|
259
|
+
* 用户信息(可选,不传则从 getImage(item) 里的 item 提取)
|
|
260
|
+
* 格式:{ userName, userSex, userPhone }
|
|
261
|
+
*/
|
|
262
|
+
userInfo: {
|
|
263
|
+
type: Object,
|
|
264
|
+
default: null,
|
|
265
|
+
},
|
|
266
|
+
/**
|
|
267
|
+
* 自定义部位列表(可选,不传则按 userSex 自动选男/女默认列表)
|
|
268
|
+
* 格式:[{ bodyFlag, order, btnName }, ...]
|
|
269
|
+
*/
|
|
270
|
+
positions: {
|
|
271
|
+
type: Array,
|
|
272
|
+
default: null,
|
|
273
|
+
},
|
|
274
|
+
/**
|
|
275
|
+
* 接口返回字段名映射(可选,适配不同部位/不同接口)
|
|
276
|
+
* 默认适配 body 模块的 getImage 接口
|
|
277
|
+
*/
|
|
278
|
+
dataMap: {
|
|
279
|
+
type: Object,
|
|
280
|
+
default: () => ({
|
|
281
|
+
gray: 'bodyImageGray', // 灰度图 base64 字段
|
|
282
|
+
temp: 'bodyImageGrayT', // 温度数据 base64 字段
|
|
283
|
+
flag: 'imageFlag', // 部位标记字段
|
|
284
|
+
}),
|
|
285
|
+
},
|
|
286
|
+
/**
|
|
287
|
+
* 场景标识(可选,'body' | 'face',默认 'body')
|
|
288
|
+
* 决定不传 positions 时自动选哪套预设:body 按性别选男/女,face 用 4 面预设
|
|
289
|
+
*/
|
|
290
|
+
scene: {
|
|
291
|
+
type: String,
|
|
292
|
+
default: 'body',
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
data() {
|
|
296
|
+
return {
|
|
297
|
+
imageDialog: true,
|
|
298
|
+
canvasObject: { canvasId: null, canvas: null, cavansRects: [] },
|
|
299
|
+
cavansRect: {
|
|
300
|
+
startX: null, startY: null, endX: null, endY: null,
|
|
301
|
+
width: null, height: null,
|
|
302
|
+
regionAvgTemp: null, regionMaxTemp: null, regionMinTemp: null, regionVariance: null,
|
|
303
|
+
},
|
|
304
|
+
measureToolActive: false,
|
|
305
|
+
measureToolShape: 'rect',
|
|
306
|
+
selectedRectId: null,
|
|
307
|
+
rectEdit: null,
|
|
308
|
+
rectTableData: {
|
|
309
|
+
infoList: [], typeTitle: '', visible: false,
|
|
310
|
+
draggingRectInfo: false, dragStartX: '', dragStartY: '',
|
|
311
|
+
},
|
|
312
|
+
canvasQueues: new ImageQueue(4),
|
|
313
|
+
weicaiCanvasDraw: {
|
|
314
|
+
isDrawing: false, currentRect: null, startX: null, startY: null,
|
|
315
|
+
ctx: null, canvas: null, eventScroll: false, eventwwwlSilder: false, temperatureData: null,
|
|
316
|
+
},
|
|
317
|
+
imageQueue: new ImageQueue(2),
|
|
318
|
+
defaultImage: require('./assets/default.png'),
|
|
319
|
+
flag: "",
|
|
320
|
+
canvasList: {},
|
|
321
|
+
showFloatingTemp: false,
|
|
322
|
+
red1Mode: false,
|
|
323
|
+
localUserInfo: { userName: '', userSex: '', userPhone: '' },
|
|
324
|
+
processor: null,
|
|
325
|
+
windowController: null,
|
|
326
|
+
thumbnailList: [
|
|
327
|
+
{
|
|
328
|
+
bodyFlag: "__slot1__", imgName: "",
|
|
329
|
+
grayStats: { min: null, max: null, avg: null },
|
|
330
|
+
tempStats: { min: null, max: null, initValue: null },
|
|
331
|
+
faceImageGray: '', faceImageGrayT: '',
|
|
332
|
+
wwRange: { min: 0, max: 255 }, wlRange: { min: 0, max: 255 },
|
|
333
|
+
wlValue: 0, wwValue: 0,
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
bodyFlag: "__slot2__", imgName: "",
|
|
337
|
+
grayStats: { min: null, max: null, avg: null },
|
|
338
|
+
tempStats: { min: null, max: null, initValue: null },
|
|
339
|
+
faceImageGray: '', faceImageGrayT: '',
|
|
340
|
+
wwRange: { min: 0, max: 255 }, wlRange: { min: 0, max: 255 },
|
|
341
|
+
wlValue: 0, wwValue: 0,
|
|
342
|
+
},
|
|
343
|
+
],
|
|
344
|
+
currentActiveCanvas: {},
|
|
345
|
+
};
|
|
346
|
+
},
|
|
347
|
+
computed: {
|
|
348
|
+
// 当前显示的用户信息(优先用 prop,其次用内部缓存)
|
|
349
|
+
currentUserInfo() {
|
|
350
|
+
if (this.userInfo) return this.userInfo;
|
|
351
|
+
return this.localUserInfo;
|
|
352
|
+
},
|
|
353
|
+
clientHeight() {
|
|
354
|
+
return (document.documentElement.clientHeight - 240) + 'px';
|
|
355
|
+
},
|
|
356
|
+
inputHeight() {
|
|
357
|
+
return (document.documentElement.clientHeight - 200) + 'px';
|
|
358
|
+
},
|
|
359
|
+
wlMax() {
|
|
360
|
+
let wlRange = this.currentActiveCanvas.wlRange;
|
|
361
|
+
return wlRange ? wlRange.max : 100;
|
|
362
|
+
},
|
|
363
|
+
wlMin() {
|
|
364
|
+
let wlRange = this.currentActiveCanvas.wlRange;
|
|
365
|
+
return wlRange ? wlRange.min : 0;
|
|
366
|
+
},
|
|
367
|
+
wwValue: {
|
|
368
|
+
get() { return Number(this.currentActiveCanvas.wwValue) * 10; },
|
|
369
|
+
set(value) { this.currentActiveCanvas.wwValue = value / 10; },
|
|
370
|
+
},
|
|
371
|
+
wlPct() {
|
|
372
|
+
const v = Number(this.currentActiveCanvas && this.currentActiveCanvas.wlValue);
|
|
373
|
+
const min = Number(this.wlMin), max = Number(this.wlMax);
|
|
374
|
+
if (isNaN(v) || isNaN(min) || isNaN(max) || max <= min) return 0;
|
|
375
|
+
return Math.max(0, Math.min(100, ((v - min) / (max - min)) * 100));
|
|
376
|
+
},
|
|
377
|
+
wwPct() {
|
|
378
|
+
const v = Number(this.currentActiveCanvas && this.currentActiveCanvas.wwValue) * 10;
|
|
379
|
+
if (isNaN(v)) return 0;
|
|
380
|
+
return Math.max(0, Math.min(100, (v / 255) * 100));
|
|
381
|
+
},
|
|
382
|
+
wlText() {
|
|
383
|
+
const v = parseFloat(this.currentActiveCanvas && this.currentActiveCanvas.wlValue);
|
|
384
|
+
return isNaN(v) ? '--' : v.toFixed(1);
|
|
385
|
+
},
|
|
386
|
+
wwText() {
|
|
387
|
+
const v = parseFloat(this.currentActiveCanvas && this.currentActiveCanvas.wwValue);
|
|
388
|
+
return isNaN(v) ? '--' : v.toFixed(1);
|
|
389
|
+
},
|
|
390
|
+
hasAnyRect() {
|
|
391
|
+
return Object.keys(this.canvasList).some(key => {
|
|
392
|
+
const item = this.canvasList[key];
|
|
393
|
+
return item && item.cavansRects && item.cavansRects.length > 0;
|
|
394
|
+
});
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
created() {
|
|
398
|
+
this.processor = new MedicalColorProcessor(0);
|
|
399
|
+
this.windowController = new WindowLevelController(this.processor);
|
|
400
|
+
},
|
|
401
|
+
methods: {
|
|
402
|
+
buildCanvasList(listDef) {
|
|
403
|
+
const result = {};
|
|
404
|
+
listDef.forEach((def) => {
|
|
405
|
+
result[def.bodyFlag] = {
|
|
406
|
+
bodyFlag: def.bodyFlag, order: def.order, imgName: '',
|
|
407
|
+
grayStats: { min: null, max: null, avg: null },
|
|
408
|
+
tempStats: { min: null, max: null, initValue: null },
|
|
409
|
+
bodyImageGray: '', bodyImageGrayT: '',
|
|
410
|
+
wwRange: { min: 0, max: 255 }, wlRange: { min: 0, max: 255 },
|
|
411
|
+
btnName: def.btnName,
|
|
412
|
+
cavansRects: [],
|
|
413
|
+
wlValue: null, wwValue: null,
|
|
414
|
+
};
|
|
415
|
+
});
|
|
416
|
+
return result;
|
|
417
|
+
},
|
|
418
|
+
loadAndDisplayImage({ displayManager, canvasData, grayBase64, canvas }) {
|
|
419
|
+
let result = displayManager.parseImageFromBase64(grayBase64);
|
|
420
|
+
if (result && result.imageData) {
|
|
421
|
+
let { grayStats, imageData } = result;
|
|
422
|
+
let { tempStats, wlRange } = canvasData;
|
|
423
|
+
canvasData.grayStats = grayStats;
|
|
424
|
+
canvasData.imageData = imageData;
|
|
425
|
+
canvas.canvasData = canvasData;
|
|
426
|
+
this.windowController.setupWindowLevel({ grayStats, tempStats, wlRange, canvasData });
|
|
427
|
+
displayManager.updateDisplay(canvasData);
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
loadTemperatureData({ displayManager, tempBase64 }) {
|
|
431
|
+
return displayManager.parseTemperatureData(tempBase64);
|
|
432
|
+
},
|
|
433
|
+
|
|
434
|
+
// ── 核心入口(对外暴露,父组件通过 ref 调用) ──
|
|
435
|
+
async getImage(item) {
|
|
436
|
+
// dataMap 兜底(双重保险:即使父组件传了 undefined 也不会崩)
|
|
437
|
+
const dataMap = this.dataMap || {
|
|
438
|
+
gray: 'bodyImageGray', temp: 'bodyImageGrayT', flag: 'imageFlag',
|
|
439
|
+
};
|
|
440
|
+
const { gray: grayKey, temp: tempKey, flag: flagKey } = dataMap;
|
|
441
|
+
// 1. 用户信息提取(仅在 prop 未传时从 item 里取)
|
|
442
|
+
if (!this.userInfo) {
|
|
443
|
+
let rawSex = item.userSex;
|
|
444
|
+
let displaySex = '';
|
|
445
|
+
if (rawSex === '男' || rawSex === '女') {
|
|
446
|
+
displaySex = rawSex;
|
|
447
|
+
} else if (rawSex == 1) {
|
|
448
|
+
displaySex = '男';
|
|
449
|
+
} else if (rawSex == 2) {
|
|
450
|
+
displaySex = '女';
|
|
451
|
+
}
|
|
452
|
+
this.localUserInfo = {
|
|
453
|
+
userName: item.userName || '',
|
|
454
|
+
userSex: displaySex,
|
|
455
|
+
userPhone: item.userPhone || '',
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// 2. 部位列表:优先用 prop positions,否则按 scene+sex 选默认
|
|
460
|
+
const rawSex = item.userSex;
|
|
461
|
+
let posList = this.positions;
|
|
462
|
+
if (!posList || !posList.length) {
|
|
463
|
+
posList = getDefaultPositions({ scene: this.scene || 'body', sex: rawSex });
|
|
464
|
+
}
|
|
465
|
+
this.canvasList = this.buildCanvasList(posList);
|
|
466
|
+
this.imageQueue = new ImageQueue(2);
|
|
467
|
+
this.thumbnailList = [
|
|
468
|
+
{ bodyFlag: '__slot1__', imgName: '', grayStats: { min: null, max: null, avg: null }, tempStats: { min: null, max: null, initValue: null }, bodyImageGray: '', bodyImageGrayT: '', wwRange: { min: 0, max: 255 }, wlRange: { min: 0, max: 255 }, wlValue: 0, wwValue: 0, btnName: '' },
|
|
469
|
+
{ bodyFlag: '__slot2__', imgName: '', grayStats: { min: null, max: null, avg: null }, tempStats: { min: null, max: null, initValue: null }, bodyImageGray: '', bodyImageGrayT: '', wwRange: { min: 0, max: 255 }, wlRange: { min: 0, max: 255 }, wlValue: 0, wwValue: 0, btnName: '' },
|
|
470
|
+
];
|
|
471
|
+
this.flag = '';
|
|
472
|
+
|
|
473
|
+
// 3. 调接口(用 prop fetchImage)
|
|
474
|
+
let data = {
|
|
475
|
+
orderCheckId: item.orderCheckId,
|
|
476
|
+
currentNumber: item.collectCount,
|
|
477
|
+
};
|
|
478
|
+
let res;
|
|
479
|
+
try {
|
|
480
|
+
res = await this.fetchImage(data);
|
|
481
|
+
} catch (e) {
|
|
482
|
+
this.$emit('error', { message: 'fetchImage 异常: ' + e.message });
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
let code = res?.code;
|
|
486
|
+
let dataList = res?.data;
|
|
487
|
+
if (dataList && dataList.length) {
|
|
488
|
+
}
|
|
489
|
+
if (code != 0 && code != '0') {
|
|
490
|
+
this.$emit('error', { message: '接口返回非0: code=' + code });
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
if (!dataList || !dataList.length) {
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// 4. 遍历返回数据,按 dataMap 取字段
|
|
498
|
+
dataList.forEach((it, i) => {
|
|
499
|
+
const grayBase64 = it[grayKey];
|
|
500
|
+
const tempBase64 = it[tempKey];
|
|
501
|
+
const itFlag = it[flagKey] || it.bodyFlag || it.faceFlag;
|
|
502
|
+
let target = itFlag ? this.canvasList[itFlag] : null;
|
|
503
|
+
if (!target) {
|
|
504
|
+
target = Object.values(this.canvasList).find(c => c.bodyFlag === itFlag);
|
|
505
|
+
}
|
|
506
|
+
if (!target) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
let img = new Image();
|
|
511
|
+
img.src = "data:image/jpeg;base64," + grayBase64;
|
|
512
|
+
target.imgName = img.src;
|
|
513
|
+
target.bodyImageGray = grayBase64;
|
|
514
|
+
target.bodyImageGrayT = tempBase64;
|
|
515
|
+
target.partId = target.bodyFlag; // ImageQueue.isExist 依赖 partId 字段
|
|
516
|
+
|
|
517
|
+
this.$nextTick(() => {
|
|
518
|
+
const refName = 'resultCanvas' + target.bodyFlag;
|
|
519
|
+
if (!this.$refs[refName]) return;
|
|
520
|
+
let canvas = this.$refs[refName][0];
|
|
521
|
+
let displayManager = new ImageDisplayManager(canvas, this.processor);
|
|
522
|
+
displayManager.setRed1Mode(this.red1Mode);
|
|
523
|
+
this.$set(target, 'displayManager', displayManager);
|
|
524
|
+
this.$set(target, 'canvas', canvas);
|
|
525
|
+
let result = this.loadTemperatureData({ displayManager, tempBase64 });
|
|
526
|
+
target.tempStats = Object.assign({}, result.stats);
|
|
527
|
+
canvas.tempData = result.data;
|
|
528
|
+
this.$set(target, 'tempData', result.data);
|
|
529
|
+
this.loadAndDisplayImage({
|
|
530
|
+
displayManager,
|
|
531
|
+
grayBase64,
|
|
532
|
+
canvasData: target,
|
|
533
|
+
canvas,
|
|
534
|
+
});
|
|
535
|
+
});
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
// 自动初始化:选中第一个有数据的部位入队右侧主画布
|
|
539
|
+
this.$nextTick(() => {
|
|
540
|
+
const firstItem = Object.values(this.canvasList).find(c => c.bodyImageGray);
|
|
541
|
+
if (firstItem) {
|
|
542
|
+
this.clickGary(firstItem);
|
|
543
|
+
this.switchRightCanvas(firstItem);
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
},
|
|
547
|
+
|
|
548
|
+
// ── 以下方法与原 PictureOperate 完全一致,无改动 ──
|
|
549
|
+
switchRightCanvas(item) {
|
|
550
|
+
if (!item || !item.bodyFlag) return;
|
|
551
|
+
const source = this.canvasList[item.bodyFlag];
|
|
552
|
+
const target = source || item;
|
|
553
|
+
this.currentActiveCanvas = target;
|
|
554
|
+
this.flag = item.bodyFlag;
|
|
555
|
+
if (target.cavansRects && target.cavansRects.length > 0) {
|
|
556
|
+
this.rectTableData.visible = true;
|
|
557
|
+
this.rectTableData.typeTitle = target.btnName || '';
|
|
558
|
+
this.rectTableData.infoList = [...target.cavansRects];
|
|
559
|
+
} else {
|
|
560
|
+
this.rectTableData.visible = false;
|
|
561
|
+
this.rectTableData.infoList = [];
|
|
562
|
+
}
|
|
563
|
+
this.selectedRectId = null;
|
|
564
|
+
canvasUtils.removeAllDOMDeleteButtons();
|
|
565
|
+
},
|
|
566
|
+
clickGary(item) {
|
|
567
|
+
this.currentActiveCanvas = item;
|
|
568
|
+
this.flag = item.bodyFlag;
|
|
569
|
+
this.imageQueue.insert(item);
|
|
570
|
+
const queueList = this.imageQueue.getQueues();
|
|
571
|
+
queueList.forEach((it, index) => {
|
|
572
|
+
if (!it) return;
|
|
573
|
+
const source = this.canvasList[it.bodyFlag];
|
|
574
|
+
this.$set(this.thumbnailList, index, Object.assign({}, source, {
|
|
575
|
+
btnName: it.btnName || source.btnName,
|
|
576
|
+
}));
|
|
577
|
+
this.$nextTick(() => {
|
|
578
|
+
const canvasRefs = this.$refs['resultCanvas_' + it.bodyFlag];
|
|
579
|
+
if (!canvasRefs) return;
|
|
580
|
+
const resultCanvas = Array.isArray(canvasRefs) ? canvasRefs[0] : canvasRefs;
|
|
581
|
+
let canvasData = this.canvasList[it.bodyFlag];
|
|
582
|
+
// 右侧大 canvas 用独立的 displayManager(不复用左侧小 canvas 的)
|
|
583
|
+
let key = 'rightDisplayManager';
|
|
584
|
+
let displayManager = canvasData[key];
|
|
585
|
+
if (!displayManager) {
|
|
586
|
+
displayManager = new ImageDisplayManager(resultCanvas, this.processor);
|
|
587
|
+
displayManager.setRed1Mode(this.red1Mode);
|
|
588
|
+
this.$set(canvasData, key, displayManager);
|
|
589
|
+
resultCanvas.canvasData = canvasData; // handleMouseDown 靠这个取值
|
|
590
|
+
if (canvasData.bodyImageGray && canvasData.bodyImageGrayT) {
|
|
591
|
+
// 复用已解析好的 tempStats(左侧 getImage 里已经算过)
|
|
592
|
+
if (!canvasData.tempData) {
|
|
593
|
+
const r = this.loadTemperatureData({ displayManager, tempBase64: canvasData.bodyImageGrayT });
|
|
594
|
+
canvasData.tempStats = Object.assign({}, r.stats);
|
|
595
|
+
resultCanvas.tempData = r.data;
|
|
596
|
+
this.$set(canvasData, 'tempData', r.data);
|
|
597
|
+
} else {
|
|
598
|
+
resultCanvas.tempData = canvasData.tempData;
|
|
599
|
+
}
|
|
600
|
+
this.loadAndDisplayImage({
|
|
601
|
+
displayManager, grayBase64: canvasData.bodyImageGray, canvasData, canvas: resultCanvas,
|
|
602
|
+
});
|
|
603
|
+
this.redrawRectsOnCanvas(canvasData);
|
|
604
|
+
}
|
|
605
|
+
} else {
|
|
606
|
+
resultCanvas.canvasData = canvasData;
|
|
607
|
+
if (canvasData.bodyImageGray) {
|
|
608
|
+
displayManager.setRed1Mode(this.red1Mode);
|
|
609
|
+
displayManager.updateDisplay(canvasData);
|
|
610
|
+
}
|
|
611
|
+
this.redrawRectsOnCanvas(canvasData);
|
|
612
|
+
}
|
|
613
|
+
resultCanvas.removeEventListener('mousedown', this.handleMouseDown);
|
|
614
|
+
resultCanvas.addEventListener('mousedown', this.handleMouseDown);
|
|
615
|
+
resultCanvas.removeEventListener('mousemove', this.handleMouseMove);
|
|
616
|
+
resultCanvas.addEventListener('mousemove', this.handleMouseMove);
|
|
617
|
+
});
|
|
618
|
+
});
|
|
619
|
+
},
|
|
620
|
+
stepWl(delta) {
|
|
621
|
+
const min = Number(this.wlMin), max = Number(this.wlMax);
|
|
622
|
+
let val = parseFloat(this.currentActiveCanvas.wlValue);
|
|
623
|
+
if (isNaN(val)) val = isNaN(min) ? 0 : min;
|
|
624
|
+
val = Math.round((val + delta) * 10) / 10;
|
|
625
|
+
if (!isNaN(min) && val < min) val = min;
|
|
626
|
+
if (!isNaN(max) && val > max) val = max;
|
|
627
|
+
this.currentActiveCanvas.wlValue = val;
|
|
628
|
+
this.$nextTick(() => {
|
|
629
|
+
const grayWW = Number(this.currentActiveCanvas.wwValue) * 10;
|
|
630
|
+
this.upDateDisplay({ grayWW, tempWL: val, canvasData: this.currentActiveCanvas });
|
|
631
|
+
});
|
|
632
|
+
},
|
|
633
|
+
stepWw(delta) {
|
|
634
|
+
let val = parseFloat(this.currentActiveCanvas.wwValue);
|
|
635
|
+
if (isNaN(val)) val = 0;
|
|
636
|
+
val = Math.round((val + delta) * 10) / 10;
|
|
637
|
+
if (val < 0) val = 0;
|
|
638
|
+
if (val > 25.5) val = 25.5;
|
|
639
|
+
this.$set(this.currentActiveCanvas, 'wwValue', val.toFixed(1));
|
|
640
|
+
this.$nextTick(() => {
|
|
641
|
+
this.upDateDisplay({
|
|
642
|
+
grayWW: Number(val) * 10, tempWL: this.currentActiveCanvas.wlValue, canvasData: this.currentActiveCanvas,
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
},
|
|
646
|
+
onRed1Change() {
|
|
647
|
+
Object.keys(this.canvasList).forEach((bodyFlag) => {
|
|
648
|
+
const item = this.canvasList[bodyFlag];
|
|
649
|
+
if (!item) return;
|
|
650
|
+
let dmLeft = item.displayManager;
|
|
651
|
+
let dmRight = item.rightDisplayManager;
|
|
652
|
+
if (dmLeft) { dmLeft.setRed1Mode(this.red1Mode); dmLeft.updateDisplay(item); }
|
|
653
|
+
if (dmRight) { dmRight.setRed1Mode(this.red1Mode); dmRight.updateDisplay(item); }
|
|
654
|
+
});
|
|
655
|
+
},
|
|
656
|
+
upDateDisplay({ grayWW, tempWL, canvasData }) {
|
|
657
|
+
this.windowController.updateWindow({ grayWW, tempWL, canvasData });
|
|
658
|
+
// 只更新右侧大 canvas,左侧缩略图保持初始状态不受影响
|
|
659
|
+
if (canvasData.rightDisplayManager) canvasData.rightDisplayManager.updateDisplay(canvasData);
|
|
660
|
+
this.redrawRectsOnCanvas(canvasData);
|
|
661
|
+
},
|
|
662
|
+
redrawRectsOnCanvas(canvasData) {
|
|
663
|
+
if (!canvasData || !canvasData.cavansRects || canvasData.cavansRects.length === 0) return;
|
|
664
|
+
// 只画右侧大 canvas(下划线前缀),左侧缩略图不显示测温框
|
|
665
|
+
const ref = this.$refs['resultCanvas_' + canvasData.bodyFlag];
|
|
666
|
+
const c = ref && ref[0];
|
|
667
|
+
if (!c) return;
|
|
668
|
+
const ctx = c.getContext('2d');
|
|
669
|
+
const updated = canvasUtils.drawExistingRectangles(ctx, c, canvasData.cavansRects, {
|
|
670
|
+
strokeColor: this.red1Mode ? '#ffffff' : '#000000',
|
|
671
|
+
textColor: this.red1Mode ? '#ffffff' : '#000000',
|
|
672
|
+
selectedId: this.selectedRectId,
|
|
673
|
+
});
|
|
674
|
+
canvasData.cavansRects = updated.map((rect, index) => ({
|
|
675
|
+
...canvasData.cavansRects[index], _renderInfo: rect._renderInfo,
|
|
676
|
+
}));
|
|
677
|
+
},
|
|
678
|
+
onScaleDown(event, type) {
|
|
679
|
+
if (event.button) return;
|
|
680
|
+
event.preventDefault();
|
|
681
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
682
|
+
this.applyScale(event.clientX, rect, type);
|
|
683
|
+
const move = (e) => this.applyScale(e.clientX, rect, type);
|
|
684
|
+
const up = () => {
|
|
685
|
+
window.removeEventListener('pointermove', move);
|
|
686
|
+
window.removeEventListener('pointerup', up);
|
|
687
|
+
};
|
|
688
|
+
window.addEventListener('pointermove', move);
|
|
689
|
+
window.addEventListener('pointerup', up);
|
|
690
|
+
},
|
|
691
|
+
applyScale(clientX, rect, type) {
|
|
692
|
+
const PAD = 9;
|
|
693
|
+
const usable = rect.width - PAD * 2;
|
|
694
|
+
if (usable <= 0) return;
|
|
695
|
+
const x = Math.max(0, Math.min(usable, clientX - rect.left - PAD));
|
|
696
|
+
const ratio = x / usable;
|
|
697
|
+
if (type === 'wl') {
|
|
698
|
+
const min = Number(this.wlMin), max = Number(this.wlMax);
|
|
699
|
+
if (isNaN(min) || isNaN(max) || max <= min) return;
|
|
700
|
+
const val = Math.max(min, Math.min(max, Math.round((min + ratio * (max - min)) * 10) / 10));
|
|
701
|
+
if (Number(this.currentActiveCanvas.wlValue) === val) return;
|
|
702
|
+
this.currentActiveCanvas.wlValue = val;
|
|
703
|
+
this.upDateDisplay({
|
|
704
|
+
grayWW: Number(this.currentActiveCanvas.wwValue) * 10, tempWL: val, canvasData: this.currentActiveCanvas,
|
|
705
|
+
});
|
|
706
|
+
} else {
|
|
707
|
+
const raw = Math.round(ratio * 255);
|
|
708
|
+
if (Number(this.wwValue) === raw) return;
|
|
709
|
+
this.wwValue = raw;
|
|
710
|
+
this.upDateDisplay({
|
|
711
|
+
grayWW: raw, tempWL: this.currentActiveCanvas.wlValue, canvasData: this.currentActiveCanvas,
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
handleScroll(event) {
|
|
716
|
+
event.preventDefault();
|
|
717
|
+
const canvas = event.target;
|
|
718
|
+
let { canvasData } = canvas;
|
|
719
|
+
let { wlRange, bodyFlag, wlValue } = this.currentActiveCanvas;
|
|
720
|
+
if (bodyFlag !== canvasData.bodyFlag) return;
|
|
721
|
+
let windowWidth = { min: 0, max: 255, value: String(Number(this.currentActiveCanvas.wwValue) * 10) };
|
|
722
|
+
let windowLevel = { min: Number(this.wlMin), max: Number(this.wlMax), value: String(wlValue) };
|
|
723
|
+
let { newWl, ww } = this.windowController.mouseScrollDelta(event, windowWidth, windowLevel, wlRange, wlValue);
|
|
724
|
+
this.currentActiveCanvas.wlValue = newWl;
|
|
725
|
+
this.upDateDisplay({ canvas, grayWW: ww, tempWL: newWl, canvasData: this.currentActiveCanvas });
|
|
726
|
+
},
|
|
727
|
+
handleMouseMove(event) {
|
|
728
|
+
const canvasBox = event.target;
|
|
729
|
+
const { canvasData } = canvasBox;
|
|
730
|
+
if (!canvasData) return;
|
|
731
|
+
const rectCanvas = canvasBox.getBoundingClientRect();
|
|
732
|
+
const scrollX = window.pageXOffset || document.documentElement.scrollLeft;
|
|
733
|
+
const scrollY = window.pageYOffset || document.documentElement.scrollTop;
|
|
734
|
+
const x = event.clientX - rectCanvas.left + scrollX;
|
|
735
|
+
const y = event.clientY - rectCanvas.top + scrollY;
|
|
736
|
+
const hit = canvasUtils.hitTestMeasurement(canvasData.cavansRects || [], x, y, this.selectedRectId);
|
|
737
|
+
if (hit) {
|
|
738
|
+
const shape = hit.rect.shape || 'rect';
|
|
739
|
+
if (hit.part === 'handle') {
|
|
740
|
+
const map = {
|
|
741
|
+
nw: 'nwse-resize', se: 'nwse-resize', ne: 'nesw-resize', sw: 'nesw-resize',
|
|
742
|
+
n: 'ns-resize', s: 'ns-resize', w: 'ew-resize', e: 'ew-resize',
|
|
743
|
+
};
|
|
744
|
+
canvasBox.style.cursor = map[hit.dir] || 'crosshair';
|
|
745
|
+
} else if (shape !== 'point') {
|
|
746
|
+
canvasBox.style.cursor = 'crosshair';
|
|
747
|
+
} else {
|
|
748
|
+
canvasBox.style.cursor = '';
|
|
749
|
+
}
|
|
750
|
+
} else {
|
|
751
|
+
canvasBox.style.cursor = '';
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
handleMouseDown(event) {
|
|
755
|
+
event.preventDefault();
|
|
756
|
+
const canvasBox = event.target;
|
|
757
|
+
let { canvasData } = canvasBox;
|
|
758
|
+
if (!canvasData) return;
|
|
759
|
+
this.currentActiveCanvas = canvasBox.canvasData;
|
|
760
|
+
const rectCanvas = canvasBox.getBoundingClientRect();
|
|
761
|
+
const scrollX = window.pageXOffset || document.documentElement.scrollLeft;
|
|
762
|
+
const scrollY = window.pageYOffset || document.documentElement.scrollTop;
|
|
763
|
+
const mouseDownX = event.clientX - rectCanvas.left + scrollX;
|
|
764
|
+
const mouseDownY = event.clientY - rectCanvas.top + scrollY;
|
|
765
|
+
const hit = canvasUtils.hitTestMeasurement(canvasData.cavansRects || [], mouseDownX, mouseDownY, this.selectedRectId);
|
|
766
|
+
if (hit) {
|
|
767
|
+
this.startRectEdit(event, canvasBox, hit, mouseDownX, mouseDownY);
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
this.clearRectSelection();
|
|
771
|
+
if (!this.measureToolActive) return;
|
|
772
|
+
this.weicaiCanvasDraw = {
|
|
773
|
+
isDrawing: false, shape: this.measureToolShape,
|
|
774
|
+
startX: mouseDownX, startY: mouseDownY,
|
|
775
|
+
currentX: mouseDownX, currentY: mouseDownY,
|
|
776
|
+
scrollX, scrollY,
|
|
777
|
+
ctx: canvasBox.getContext("2d", { willReadFrequently: true }),
|
|
778
|
+
canvas: canvasBox, canvasData: canvasBox.canvasData,
|
|
779
|
+
temperatureData: canvasData.tempData,
|
|
780
|
+
scaleFactor: { x: canvasBox.width / rectCanvas.width, y: canvasBox.height / rectCanvas.height },
|
|
781
|
+
};
|
|
782
|
+
if (this.measureToolShape === 'point') {
|
|
783
|
+
this.weicaiCanvasDraw.isDrawing = true;
|
|
784
|
+
this.finalizeRectangle();
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
canvasBox.addEventListener("mousemove", this.moveRectHandler);
|
|
788
|
+
canvasBox.addEventListener("mouseup", this.moveRectUp);
|
|
789
|
+
},
|
|
790
|
+
startRectEdit(event, canvasBox, hit, mouseX, mouseY) {
|
|
791
|
+
this.selectedRectId = hit.rect.id;
|
|
792
|
+
this.rectEdit = {
|
|
793
|
+
mode: hit.part === 'handle' ? 'resize' : 'move',
|
|
794
|
+
dir: hit.dir || 'se', rectId: hit.rect.id, mouseX, mouseY,
|
|
795
|
+
orig: { startX: hit.rect.startX, startY: hit.rect.startY, endX: hit.rect.endX, endY: hit.rect.endY },
|
|
796
|
+
canvas: canvasBox, canvasData: canvasBox.canvasData,
|
|
797
|
+
};
|
|
798
|
+
window.addEventListener('mousemove', this.moveRectEdit);
|
|
799
|
+
window.addEventListener('mouseup', this.endRectEdit);
|
|
800
|
+
this.redrawCanvasWithRectangles();
|
|
801
|
+
this.syncSelectedDeleteButton();
|
|
802
|
+
},
|
|
803
|
+
moveRectEdit(event) {
|
|
804
|
+
const e = this.rectEdit;
|
|
805
|
+
if (!e) return;
|
|
806
|
+
const rectCanvas = e.canvas.getBoundingClientRect();
|
|
807
|
+
const scrollX = window.pageXOffset || document.documentElement.scrollLeft;
|
|
808
|
+
const scrollY = window.pageYOffset || document.documentElement.scrollTop;
|
|
809
|
+
const curX = event.clientX - rectCanvas.left + scrollX;
|
|
810
|
+
const curY = event.clientY - rectCanvas.top + scrollY;
|
|
811
|
+
const dx = curX - e.mouseX;
|
|
812
|
+
const dy = curY - e.mouseY;
|
|
813
|
+
const list = e.canvasData.cavansRects || [];
|
|
814
|
+
const rect = list.find(r => r.id === e.rectId);
|
|
815
|
+
if (!rect) return;
|
|
816
|
+
const shape = rect.shape || 'rect';
|
|
817
|
+
const W = rectCanvas.width, H = rectCanvas.height;
|
|
818
|
+
const clamp = (v, max) => Math.max(0, Math.min(max, v));
|
|
819
|
+
if (e.mode === 'move') {
|
|
820
|
+
const w = e.orig.endX - e.orig.startX, h = e.orig.endY - e.orig.startY;
|
|
821
|
+
const nx = clamp(e.orig.startX + dx, W - Math.max(w, 0));
|
|
822
|
+
const ny = clamp(e.orig.startY + dy, H - Math.max(h, 0));
|
|
823
|
+
rect.startX = nx; rect.startY = ny;
|
|
824
|
+
rect.endX = nx + w; rect.endY = ny + h;
|
|
825
|
+
} else if (shape === 'circle' || shape === 'rect') {
|
|
826
|
+
const dir = e.dir || 'se';
|
|
827
|
+
const MIN = 4;
|
|
828
|
+
let x1 = Math.min(e.orig.startX, e.orig.endX), x2 = Math.max(e.orig.startX, e.orig.endX);
|
|
829
|
+
let y1 = Math.min(e.orig.startY, e.orig.endY), y2 = Math.max(e.orig.startY, e.orig.endY);
|
|
830
|
+
if (dir.includes('w')) x1 = clamp(x1 + dx, x2 - MIN);
|
|
831
|
+
if (dir.includes('e')) x2 = clamp(x2 + dx, W);
|
|
832
|
+
if (dir.includes('n')) y1 = clamp(y1 + dy, y2 - MIN);
|
|
833
|
+
if (dir.includes('s')) y2 = clamp(y2 + dy, H);
|
|
834
|
+
rect.startX = x1; rect.startY = y1; rect.endX = x2; rect.endY = y2;
|
|
835
|
+
rect.width = x2 - x1; rect.height = y2 - y1;
|
|
836
|
+
}
|
|
837
|
+
this.redrawCanvasWithRectangles();
|
|
838
|
+
this.syncSelectedDeleteButton();
|
|
839
|
+
},
|
|
840
|
+
endRectEdit() {
|
|
841
|
+
window.removeEventListener('mousemove', this.moveRectEdit);
|
|
842
|
+
window.removeEventListener('mouseup', this.endRectEdit);
|
|
843
|
+
const e = this.rectEdit;
|
|
844
|
+
this.rectEdit = null;
|
|
845
|
+
if (!e) return;
|
|
846
|
+
const list = e.canvasData.cavansRects || [];
|
|
847
|
+
const rect = list.find(r => r.id === e.rectId);
|
|
848
|
+
if (!rect) return;
|
|
849
|
+
const shape = rect.shape || 'rect';
|
|
850
|
+
const regionData = canvasUtils.extractRegionData(
|
|
851
|
+
e.canvas.tempData, rect.startX, rect.startY, rect.endX, rect.endY, e.canvas, shape,
|
|
852
|
+
);
|
|
853
|
+
const stats = canvasUtils.calculateStats(regionData);
|
|
854
|
+
if (stats) Object.assign(rect, stats);
|
|
855
|
+
this.rectTableData.infoList = [...list];
|
|
856
|
+
this.redrawCanvasWithRectangles();
|
|
857
|
+
this.syncSelectedDeleteButton();
|
|
858
|
+
},
|
|
859
|
+
clearRectSelection() {
|
|
860
|
+
if (!this.selectedRectId) return;
|
|
861
|
+
this.selectedRectId = null;
|
|
862
|
+
canvasUtils.removeAllDOMDeleteButtons();
|
|
863
|
+
this.redrawCanvasWithRectangles();
|
|
864
|
+
},
|
|
865
|
+
resetCanvasCursor(canvasBox) {
|
|
866
|
+
if (canvasBox) canvasBox.style.cursor = '';
|
|
867
|
+
},
|
|
868
|
+
syncSelectedDeleteButton() {
|
|
869
|
+
canvasUtils.removeAllDOMDeleteButtons();
|
|
870
|
+
if (!this.selectedRectId) return;
|
|
871
|
+
const list = this.currentActiveCanvas && this.currentActiveCanvas.cavansRects;
|
|
872
|
+
if (!list || !list.length) return;
|
|
873
|
+
const rect = list.find(r => r.id === this.selectedRectId);
|
|
874
|
+
if (!rect || !rect._renderInfo) return;
|
|
875
|
+
const ref = this.$refs['resultCanvas_' + this.currentActiveCanvas.bodyFlag];
|
|
876
|
+
const canvas = ref && ref[0];
|
|
877
|
+
if (!canvas) return;
|
|
878
|
+
canvasUtils.createDOMDeleteButton(rect, canvas, this.deleteRectFromList.bind(this), this.$refs.parent);
|
|
879
|
+
},
|
|
880
|
+
moveRectHandler(event) {
|
|
881
|
+
let { startX, startY, scrollX, scrollY, canvas } = this.weicaiCanvasDraw;
|
|
882
|
+
const rect = canvas.getBoundingClientRect();
|
|
883
|
+
let currentX = event.clientX - rect.left + scrollX;
|
|
884
|
+
let currentY = event.clientY - rect.top + scrollY;
|
|
885
|
+
if (this.weicaiCanvasDraw.shape === 'circle' && event.shiftKey) {
|
|
886
|
+
const size = Math.max(Math.abs(currentX - startX), Math.abs(currentY - startY));
|
|
887
|
+
currentX = startX + (currentX >= startX ? size : -size);
|
|
888
|
+
currentY = startY + (currentY >= startY ? size : -size);
|
|
889
|
+
}
|
|
890
|
+
const distance = Math.sqrt(Math.pow(currentX - startX, 2) + Math.pow(currentY - startY, 2));
|
|
891
|
+
if (distance > 5 && !this.weicaiCanvasDraw.isDrawing) this.weicaiCanvasDraw.isDrawing = true;
|
|
892
|
+
if (!this.weicaiCanvasDraw.isDrawing) return;
|
|
893
|
+
this.weicaiCanvasDraw.currentX = currentX;
|
|
894
|
+
this.weicaiCanvasDraw.currentY = currentY;
|
|
895
|
+
this.drawSelectionRectangle(this.weicaiCanvasDraw.shape);
|
|
896
|
+
},
|
|
897
|
+
moveRectUp(event) {
|
|
898
|
+
if (!this.weicaiCanvasDraw.isDrawing) {
|
|
899
|
+
if (this.weicaiCanvasDraw.canvas) {
|
|
900
|
+
this.weicaiCanvasDraw.canvas.removeEventListener("mousemove", this.moveRectHandler);
|
|
901
|
+
this.weicaiCanvasDraw.canvas.removeEventListener("mouseup", this.moveRectUp);
|
|
902
|
+
}
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
this.weicaiCanvasDraw.isDrawing = false;
|
|
906
|
+
if (this.weicaiCanvasDraw.canvas) {
|
|
907
|
+
this.weicaiCanvasDraw.canvas.removeEventListener("mousemove", this.moveRectHandler);
|
|
908
|
+
this.weicaiCanvasDraw.canvas.removeEventListener("mouseup", this.moveRectUp);
|
|
909
|
+
}
|
|
910
|
+
this.finalizeRectangle();
|
|
911
|
+
},
|
|
912
|
+
finalizeRectangle() {
|
|
913
|
+
const shape = this.weicaiCanvasDraw.shape || this.measureToolShape || 'rect';
|
|
914
|
+
if (shape !== 'point') {
|
|
915
|
+
const dist = Math.sqrt(
|
|
916
|
+
Math.pow(this.weicaiCanvasDraw.currentX - this.weicaiCanvasDraw.startX, 2) +
|
|
917
|
+
Math.pow(this.weicaiCanvasDraw.currentY - this.weicaiCanvasDraw.startY, 2),
|
|
918
|
+
);
|
|
919
|
+
if (dist < 6) return;
|
|
920
|
+
}
|
|
921
|
+
const regionData = canvasUtils.extractRegionData(
|
|
922
|
+
this.weicaiCanvasDraw.canvas.tempData,
|
|
923
|
+
this.weicaiCanvasDraw.startX, this.weicaiCanvasDraw.startY,
|
|
924
|
+
this.weicaiCanvasDraw.currentX, this.weicaiCanvasDraw.currentY,
|
|
925
|
+
this.weicaiCanvasDraw.canvas, shape,
|
|
926
|
+
);
|
|
927
|
+
const stats = canvasUtils.calculateStats(regionData);
|
|
928
|
+
if (stats) {
|
|
929
|
+
const rectCount = this.currentActiveCanvas.cavansRects ? this.currentActiveCanvas.cavansRects.length + 1 : 1;
|
|
930
|
+
let width = 0, height = 0;
|
|
931
|
+
if (shape === 'point') { width = 3; height = 3; }
|
|
932
|
+
else {
|
|
933
|
+
width = Math.abs(this.weicaiCanvasDraw.currentX - this.weicaiCanvasDraw.startX);
|
|
934
|
+
height = Math.abs(this.weicaiCanvasDraw.currentY - this.weicaiCanvasDraw.startY);
|
|
935
|
+
}
|
|
936
|
+
const rectData = {
|
|
937
|
+
shape,
|
|
938
|
+
startX: this.weicaiCanvasDraw.startX, startY: this.weicaiCanvasDraw.startY,
|
|
939
|
+
endX: this.weicaiCanvasDraw.currentX, endY: this.weicaiCanvasDraw.currentY,
|
|
940
|
+
width, height, ...stats,
|
|
941
|
+
};
|
|
942
|
+
const newRect = canvasUtils.createRectangle(rectData, rectCount);
|
|
943
|
+
if (!this.currentActiveCanvas.cavansRects) this.currentActiveCanvas.cavansRects = [];
|
|
944
|
+
this.currentActiveCanvas.cavansRects.push(newRect);
|
|
945
|
+
this.rectTableData.visible = true;
|
|
946
|
+
this.rectTableData.typeTitle = this.currentActiveCanvas.btnName;
|
|
947
|
+
this.rectTableData.infoList = [...this.currentActiveCanvas.cavansRects];
|
|
948
|
+
this.redrawCanvasWithRectangles();
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
drawSelectionRectangle(shape) {
|
|
952
|
+
const { ctx, canvas, startX, startY, currentX, currentY, scaleFactor } = this.weicaiCanvasDraw;
|
|
953
|
+
if (canvas.canvasData.bodyFlag !== this.currentActiveCanvas.bodyFlag) return;
|
|
954
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
955
|
+
let { wwValue: grayWW, wlValue: tempWL } = canvas.canvasData;
|
|
956
|
+
if (canvas.canvasData && canvas.canvasData.imageData) {
|
|
957
|
+
this.upDateDisplay({ grayWW: Number(grayWW) * 10, tempWL, canvasData: canvas.canvasData });
|
|
958
|
+
}
|
|
959
|
+
this.drawExistingRectangles(ctx, canvas);
|
|
960
|
+
if (!this.weicaiCanvasDraw.isDrawing) return;
|
|
961
|
+
const rectInfo = canvasUtils.drawSelectionRectangle(ctx, {
|
|
962
|
+
startX, startY, currentX, currentY, scaleFactor,
|
|
963
|
+
canvasWidth: canvas.width, canvasHeight: canvas.height,
|
|
964
|
+
strokeColor: this.red1Mode ? "#ffffff" : "#000000",
|
|
965
|
+
shape: shape || this.measureToolShape,
|
|
966
|
+
});
|
|
967
|
+
this.weicaiCanvasDraw.currentRect = rectInfo;
|
|
968
|
+
},
|
|
969
|
+
deleteRectFromList(rectItem) {
|
|
970
|
+
const result = canvasUtils.deleteRectangleById(this.currentActiveCanvas.cavansRects, rectItem.id);
|
|
971
|
+
this.resetCanvasCursor(this.currentActiveCanvas.canvas);
|
|
972
|
+
if (result.success) {
|
|
973
|
+
const button = document.getElementById(`delete-btn-${rectItem.id}`);
|
|
974
|
+
if (button) button.remove();
|
|
975
|
+
this.currentActiveCanvas.cavansRects = result.updatedRectangles;
|
|
976
|
+
this.rectTableData.infoList = this.currentActiveCanvas.cavansRects;
|
|
977
|
+
this.selectedRectId = null;
|
|
978
|
+
if (this.currentActiveCanvas.cavansRects.length === 0) this.rectTableData.visible = false;
|
|
979
|
+
this.redrawCanvasWithRectangles();
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
drawExistingRectangles(ctx, canvas) {
|
|
983
|
+
if (!this.currentActiveCanvas.cavansRects || this.currentActiveCanvas.cavansRects.length === 0) return;
|
|
984
|
+
const rectStyle = {
|
|
985
|
+
strokeColor: this.red1Mode ? "#ffffff" : "#000000",
|
|
986
|
+
textColor: this.red1Mode ? "#ffffff" : "#000000",
|
|
987
|
+
selectedId: this.selectedRectId,
|
|
988
|
+
};
|
|
989
|
+
const updatedRectangles = canvasUtils.drawExistingRectangles(ctx, canvas, this.currentActiveCanvas.cavansRects, rectStyle);
|
|
990
|
+
this.currentActiveCanvas.cavansRects = updatedRectangles.map((rect, index) => ({
|
|
991
|
+
...this.currentActiveCanvas.cavansRects[index], _renderInfo: rect._renderInfo,
|
|
992
|
+
}));
|
|
993
|
+
this.syncSelectedDeleteButton();
|
|
994
|
+
},
|
|
995
|
+
selectMeasureTool(shape) {
|
|
996
|
+
if (this.measureToolActive && this.measureToolShape === shape) {
|
|
997
|
+
this.measureToolActive = false;
|
|
998
|
+
} else {
|
|
999
|
+
this.measureToolActive = true;
|
|
1000
|
+
this.measureToolShape = shape;
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
1003
|
+
closeRectInfoList() { this.rectTableData.visible = false; },
|
|
1004
|
+
resetRectPanel() {
|
|
1005
|
+
if (this.rectTableData.visible && this.$refs.rectPanel) {
|
|
1006
|
+
this.$refs.rectPanel.resetPosition();
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
this.rectTableData.visible = true;
|
|
1010
|
+
this.$nextTick(() => { if (this.$refs.rectPanel) this.$refs.rectPanel.resetPosition(); });
|
|
1011
|
+
},
|
|
1012
|
+
clearAllMeasurements() {
|
|
1013
|
+
this.selectedRectId = null;
|
|
1014
|
+
canvasUtils.removeAllDOMDeleteButtons();
|
|
1015
|
+
Object.keys(this.canvasList).forEach((bodyFlag) => {
|
|
1016
|
+
const item = this.canvasList[bodyFlag];
|
|
1017
|
+
if (!item) return;
|
|
1018
|
+
item.cavansRects = [];
|
|
1019
|
+
const ref = this.$refs['resultCanvas_' + bodyFlag];
|
|
1020
|
+
const canvas = ref && ref[0];
|
|
1021
|
+
if (canvas) {
|
|
1022
|
+
canvas.style.cursor = '';
|
|
1023
|
+
const dm = item.rightDisplayManager || item.displayManager;
|
|
1024
|
+
if (dm) dm.updateDisplay(item);
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
this.rectTableData.infoList = [];
|
|
1028
|
+
this.rectTableData.visible = false;
|
|
1029
|
+
},
|
|
1030
|
+
redrawCanvasWithRectangles() {
|
|
1031
|
+
if (this.currentActiveCanvas && this.currentActiveCanvas.bodyFlag) {
|
|
1032
|
+
this.$nextTick(() => {
|
|
1033
|
+
const canvasRef = this.$refs['resultCanvas_' + this.currentActiveCanvas.bodyFlag];
|
|
1034
|
+
if (canvasRef && canvasRef[0]) {
|
|
1035
|
+
const canvas = canvasRef[0];
|
|
1036
|
+
const ctx = canvas.getContext('2d');
|
|
1037
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
1038
|
+
let { canvasData } = canvas;
|
|
1039
|
+
if (canvas.canvasData && canvas.canvasData.imageData) {
|
|
1040
|
+
// 优先用 rightDisplayManager(右侧大 canvas 的 manager),
|
|
1041
|
+
// 因为 canvasUtils.drawExistingRectangles 是画到 canvas 参数(右侧大 canvas)上,
|
|
1042
|
+
// 而 updateDisplay 必须也画到同一个 canvas 才对
|
|
1043
|
+
const dm = canvasData.rightDisplayManager || canvasData.displayManager;
|
|
1044
|
+
if (dm) dm.updateDisplay(canvasData);
|
|
1045
|
+
}
|
|
1046
|
+
this.drawExistingRectangles(ctx, canvas);
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
},
|
|
1051
|
+
getSelectedRegionData() {
|
|
1052
|
+
let canvas = this.weicaiCanvasDraw.canvas;
|
|
1053
|
+
let temperatureData = this.weicaiCanvasDraw.canvas.tempData;
|
|
1054
|
+
if (!temperatureData) return [];
|
|
1055
|
+
return canvasUtils.extractRegionData(
|
|
1056
|
+
temperatureData,
|
|
1057
|
+
this.weicaiCanvasDraw.startX, this.weicaiCanvasDraw.startY,
|
|
1058
|
+
this.weicaiCanvasDraw.currentX, this.weicaiCanvasDraw.currentY,
|
|
1059
|
+
canvas.width, canvas.height,
|
|
1060
|
+
);
|
|
1061
|
+
},
|
|
1062
|
+
addRectangleToList() {
|
|
1063
|
+
const rectCount = this.currentActiveCanvas.cavansRects ? this.currentActiveCanvas.cavansRects.length + 1 : 1;
|
|
1064
|
+
const newRect = canvasUtils.createRectangle({
|
|
1065
|
+
startX: this.cavansRect.startX, startY: this.cavansRect.startY,
|
|
1066
|
+
endX: this.cavansRect.endX, endY: this.cavansRect.endY,
|
|
1067
|
+
width: this.cavansRect.width, height: this.cavansRect.height,
|
|
1068
|
+
regionAvgTemp: this.cavansRect.regionAvgTemp,
|
|
1069
|
+
regionMaxTemp: this.cavansRect.regionMaxTemp,
|
|
1070
|
+
regionMinTemp: this.cavansRect.regionMinTemp,
|
|
1071
|
+
regionVariance: this.cavansRect.regionVariance,
|
|
1072
|
+
}, rectCount);
|
|
1073
|
+
if (!this.currentActiveCanvas.cavansRects) this.currentActiveCanvas.cavansRects = [];
|
|
1074
|
+
this.currentActiveCanvas.cavansRects.push(newRect);
|
|
1075
|
+
this.rectTableData.visible = true;
|
|
1076
|
+
this.rectTableData.typeTitle = this.currentActiveCanvas.btnName;
|
|
1077
|
+
this.rectTableData.infoList = [...this.currentActiveCanvas.cavansRects];
|
|
1078
|
+
},
|
|
1079
|
+
calculateStats(regionData) {
|
|
1080
|
+
const stats = canvasUtils.calculateStats(regionData);
|
|
1081
|
+
if (stats) {
|
|
1082
|
+
this.cavansRect.regionAvgTemp = stats.regionAvgTemp;
|
|
1083
|
+
this.cavansRect.regionMaxTemp = stats.regionMaxTemp;
|
|
1084
|
+
this.cavansRect.regionMinTemp = stats.regionMinTemp;
|
|
1085
|
+
this.cavansRect.regionVariance = stats.regionVariance;
|
|
1086
|
+
}
|
|
1087
|
+
},
|
|
1088
|
+
handleBeforeClose() { this.imageDialog = false; },
|
|
1089
|
+
handleDialogClosed() {
|
|
1090
|
+
canvasUtils.removeAllDOMDeleteButtons();
|
|
1091
|
+
this.$emit("closedDialog");
|
|
1092
|
+
},
|
|
1093
|
+
},
|
|
1094
|
+
mounted() {
|
|
1095
|
+
this.imageQueue = new ImageQueue(2);
|
|
1096
|
+
this._bodyOverflow = document.body.style.overflow;
|
|
1097
|
+
this._htmlOverflow = document.documentElement.style.overflow;
|
|
1098
|
+
document.body.style.overflow = 'hidden';
|
|
1099
|
+
document.documentElement.style.overflow = 'hidden';
|
|
1100
|
+
document.body.style.margin = '0';
|
|
1101
|
+
document.documentElement.style.margin = '0';
|
|
1102
|
+
},
|
|
1103
|
+
beforeDestroy() {
|
|
1104
|
+
if (document.body) {
|
|
1105
|
+
document.body.style.overflow = this._bodyOverflow || '';
|
|
1106
|
+
document.body.style.margin = '';
|
|
1107
|
+
}
|
|
1108
|
+
if (document.documentElement) {
|
|
1109
|
+
document.documentElement.style.overflow = this._htmlOverflow || '';
|
|
1110
|
+
document.documentElement.style.margin = '';
|
|
1111
|
+
}
|
|
1112
|
+
},
|
|
1113
|
+
};
|
|
1114
|
+
</script>
|
|
1115
|
+
|
|
1116
|
+
<style lang="less" scoped>
|
|
1117
|
+
* { box-sizing: border-box !important; }
|
|
1118
|
+
|
|
1119
|
+
.closed {
|
|
1120
|
+
width: 40px; height: 40px; line-height: 38px;
|
|
1121
|
+
border-radius: 50%; font-size: 40px; text-align: center;
|
|
1122
|
+
position: absolute; top: 10px; right: 20px; z-index: 20;
|
|
1123
|
+
color: #409eff; cursor: pointer;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
.container {
|
|
1127
|
+
position: fixed; top: 0; left: 0; right: 0; bottom: 0;
|
|
1128
|
+
display: flex; flex-direction: column; margin: 0;
|
|
1129
|
+
padding-top: 0; box-sizing: border-box; overflow: hidden;
|
|
1130
|
+
background: #f4f6fa; z-index: 1; pointer-events: auto;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
.title {
|
|
1134
|
+
flex: none; width: 100%; height: 26px;
|
|
1135
|
+
font-family: SimSun, 宋体; font-size: 12px; font-weight: bold;
|
|
1136
|
+
line-height: 26px; text-align: center; color: #ffffff;
|
|
1137
|
+
background: #95adc8; box-sizing: border-box;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
.stats-container { flex: none; min-height: 0; height: auto; margin: 0; }
|
|
1141
|
+
|
|
1142
|
+
.color-img {
|
|
1143
|
+
position: relative; width: 100%; height: 100%;
|
|
1144
|
+
margin-right: 5px; display: flex; flex-direction: column;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
.delete-btn {
|
|
1148
|
+
position: absolute; background: rgba(255, 0, 0, 0.7); color: white;
|
|
1149
|
+
border: none; border-radius: 3px; width: 40px; height: 20px;
|
|
1150
|
+
display: flex; align-items: center; justify-content: center;
|
|
1151
|
+
cursor: pointer; font-size: 30px; font-weight: bold; pointer-events: auto; box-sizing: border-box;
|
|
1152
|
+
}
|
|
1153
|
+
.delete-btn:hover { background: rgba(255, 0, 0, 1); }
|
|
1154
|
+
|
|
1155
|
+
.right-area { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
|
|
1156
|
+
|
|
1157
|
+
.red1-switch {
|
|
1158
|
+
flex: none; min-height: 56px; padding: 6px 4px 8px;
|
|
1159
|
+
display: flex; align-items: center; gap: 12px;
|
|
1160
|
+
box-sizing: border-box; text-align: left;
|
|
1161
|
+
font-size: 16px; font-weight: 800; letter-spacing: 2px; color: #1f2937;
|
|
1162
|
+
|
|
1163
|
+
.user-info-item {
|
|
1164
|
+
font-size: 14px; font-weight: normal; letter-spacing: normal; color: #303133;
|
|
1165
|
+
em { font-style: normal; color: #909399; margin-right: 2px; }
|
|
1166
|
+
}
|
|
1167
|
+
.measure-tool-group {
|
|
1168
|
+
display: inline-flex; align-items: center; gap: 4px;
|
|
1169
|
+
background: #f5f7fa; border: 1px solid #dcdfe6; border-radius: 6px; padding: 3px 5px;
|
|
1170
|
+
.mtg-label { font-size: 13px; color: #606266; margin-right: 2px; font-weight: 600; }
|
|
1171
|
+
.mtg-btn {
|
|
1172
|
+
width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
|
|
1173
|
+
border: 1px solid transparent; background: transparent; border-radius: 4px;
|
|
1174
|
+
cursor: pointer; font-size: 16px; color: #606266; padding: 0; transition: all 0.15s; line-height: 1;
|
|
1175
|
+
&:hover { color: #409eff; }
|
|
1176
|
+
&.active {
|
|
1177
|
+
background: #409eff; color: #ffffff; border-color: #409eff;
|
|
1178
|
+
box-shadow: 0 2px 4px rgba(64, 158, 255, 0.3);
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
.reset-panel-btn { font-size: 12px; font-weight: 600; padding: 8px 12px; height: auto; }
|
|
1183
|
+
::v-deep .el-checkbox__label { font-size: 17px; font-weight: 900; letter-spacing: 2px; padding-left: 8px; }
|
|
1184
|
+
::v-deep .el-checkbox__inner { width: 22px; height: 22px; }
|
|
1185
|
+
::v-deep .el-checkbox__input.is-checked .el-checkbox__inner::after { width: 10px; height: 6px; }
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
.body-container {
|
|
1189
|
+
flex: 1; min-height: 0; margin: 0; width: 100%; padding: 12px;
|
|
1190
|
+
box-sizing: border-box; overflow: hidden; display: flex; gap: 12px;
|
|
1191
|
+
|
|
1192
|
+
.init-pic {
|
|
1193
|
+
flex: 0 0 30%; min-height: 0; max-height: 100%; overflow: hidden;
|
|
1194
|
+
text-align: center; padding: 10px; padding-bottom: 0; box-sizing: border-box;
|
|
1195
|
+
background: #fff; border: 1px solid #dcdfe6; border-radius: 8px;
|
|
1196
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04); position: relative;
|
|
1197
|
+
display: flex; flex-direction: column;
|
|
1198
|
+
&::-webkit-scrollbar { width: 6px; }
|
|
1199
|
+
&::-webkit-scrollbar-track { background: transparent; }
|
|
1200
|
+
&::-webkit-scrollbar-thumb { background: #c8d1dc; border-radius: 3px; }
|
|
1201
|
+
&::-webkit-scrollbar-thumb:hover { background: #a0b0c2; }
|
|
1202
|
+
scrollbar-width: thin; scrollbar-color: #c8d1dc transparent;
|
|
1203
|
+
|
|
1204
|
+
.inputContainer {
|
|
1205
|
+
flex: none; width: 100%; padding: 10px 10px; margin-top: 8px;
|
|
1206
|
+
background: #EFF6FF; box-sizing: border-box;
|
|
1207
|
+
.window-row {
|
|
1208
|
+
flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 3px 0;
|
|
1209
|
+
.row-label { flex: none; font-size: 16px; line-height: 1; color: #2563EB; white-space: nowrap; }
|
|
1210
|
+
.row-value { flex: none; min-width: 48px; font-size: 18px; font-variant-numeric: tabular-nums; line-height: 1.8; text-align: left; color: #2563EB; }
|
|
1211
|
+
.row-container { width: 100%; display: flex; background: #fff;
|
|
1212
|
+
.row-btn {
|
|
1213
|
+
flex: none; width: 14px; height: 22px; padding: 0; font-size: 26px; line-height: 22px;
|
|
1214
|
+
font-weight: 700; text-align: center; color: #303133; background: transparent; border: none; cursor: pointer; transition: color 0.2s;
|
|
1215
|
+
&:hover { color: #409eff; } &:active { color: #1f7ad0; }
|
|
1216
|
+
}
|
|
1217
|
+
.row-scale {
|
|
1218
|
+
flex: 1; min-width: 40px; height: 22px; padding: 0 6px; box-sizing: border-box;
|
|
1219
|
+
display: flex; align-items: center; cursor: ew-resize; touch-action: none; user-select: none;
|
|
1220
|
+
.row-rail { position: relative; width: 100%; height: 2px; border-radius: 1px; background: #c9d4de;
|
|
1221
|
+
.row-fill { position: absolute; top: 0; left: 0; height: 100%; background: transparent; }
|
|
1222
|
+
.row-thumb {
|
|
1223
|
+
position: absolute; top: 50%; width: 18px; height: 23px; margin-left: -5px;
|
|
1224
|
+
border: none; border-radius: 2px; background: rgba(120, 140, 160, 0.8); transform: translateY(-50%);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
.img-container {
|
|
1233
|
+
flex: 1; min-height: 0; width: 100%; padding: 5px; margin: 0; box-sizing: border-box;
|
|
1234
|
+
display: flex; flex-wrap: wrap; justify-content: space-between;
|
|
1235
|
+
overflow-y: auto; overflow-x: hidden; align-content: flex-start;
|
|
1236
|
+
&::-webkit-scrollbar { width: 6px; }
|
|
1237
|
+
&::-webkit-scrollbar-track { background: transparent; }
|
|
1238
|
+
&::-webkit-scrollbar-thumb { background: #c8d1dc; border-radius: 3px; }
|
|
1239
|
+
&::-webkit-scrollbar-thumb:hover { background: #a0b0c2; }
|
|
1240
|
+
scrollbar-width: thin; scrollbar-color: #c8d1dc transparent;
|
|
1241
|
+
|
|
1242
|
+
.pic-item {
|
|
1243
|
+
width: 49%; min-height: 200px; max-height: 350px;
|
|
1244
|
+
.img-item {
|
|
1245
|
+
width: 100%; position: relative;
|
|
1246
|
+
.activeCanvas {
|
|
1247
|
+
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
|
|
1248
|
+
box-sizing: border-box; background: rgba(64, 158, 255, 0.12);
|
|
1249
|
+
border: 2px solid #409eff; pointer-events: none; z-index: 2;
|
|
1250
|
+
}
|
|
1251
|
+
.imgClass { width: 100%; }
|
|
1252
|
+
}
|
|
1253
|
+
.picText {
|
|
1254
|
+
width: 100px; height: 32px; line-height: 32px; margin: 10px auto 4px;
|
|
1255
|
+
font-size: 13px; color: #606266; background: #fff;
|
|
1256
|
+
border: 1px solid #dcdfe6; border-radius: 4px;
|
|
1257
|
+
}
|
|
1258
|
+
.active { color: #fff; background: #409eff; border-color: #409eff; }
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
.color-map {
|
|
1264
|
+
flex: 1; min-width: 0; min-height: 0; display: flex; overflow: hidden;
|
|
1265
|
+
padding: 8px; box-sizing: border-box; background: #fff;
|
|
1266
|
+
.color-item {
|
|
1267
|
+
flex: 1; min-width: 0; height: 100%; display: flex; justify-content: space-between;
|
|
1268
|
+
.color-img {
|
|
1269
|
+
flex: 1; min-width: 0; width: 100%;
|
|
1270
|
+
img { width: 100%; height: 100%; margin-right: 50px; }
|
|
1271
|
+
.tempBtn1 { position: absolute; left: 0; right: 0; bottom: -40px; text-align: center; }
|
|
1272
|
+
.tempBtn2 { position: absolute; left: 60%; right: 0px; bottom: -40px; text-align: center; }
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
::v-deep element.style { max-width: 600px !important; }
|
|
1279
|
+
|
|
1280
|
+
.floating-temp {
|
|
1281
|
+
position: absolute; padding: 5px 10px; background-color: rgba(0, 0, 0, 0.7);
|
|
1282
|
+
color: white; display: none; border-radius: 4px; font-size: 14px;
|
|
1283
|
+
pointer-events: none; z-index: 88; white-space: nowrap;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
.color-body { position: relative; flex: 1; min-height: 0; background: #000; }
|
|
1287
|
+
|
|
1288
|
+
.canvas-item {
|
|
1289
|
+
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
|
|
1290
|
+
display: block; border: none; will-change: transform; object-fit: contain;
|
|
1291
|
+
}
|
|
1292
|
+
.canvas-item.active-canvas { outline: 2px solid #409eff; outline-offset: -2px; }
|
|
1293
|
+
|
|
1294
|
+
.placeholder-image {
|
|
1295
|
+
position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
.color-img {
|
|
1299
|
+
display: flex; flex-direction: column; flex: 1; min-height: 0;
|
|
1300
|
+
position: relative; width: 100%; height: 100%; margin-right: 5px;
|
|
1301
|
+
background: #ffffff; border: 1px solid #d9d9d9; box-sizing: border-box; overflow: hidden;
|
|
1302
|
+
&.is-active { border-color: #409eff; .title { background: #409eff; } }
|
|
1303
|
+
}
|
|
1304
|
+
</style>
|