bfg-common 1.4.391 → 1.4.393
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/components/common/layout/theHeader/feedback/new/additionalDetails/AdditionalDetails.vue
CHANGED
|
@@ -62,6 +62,77 @@
|
|
|
62
62
|
</ui-button>
|
|
63
63
|
</div>
|
|
64
64
|
|
|
65
|
+
<div v-if="optionsModel.isAnnotateImage" class="drawer-btn-container">
|
|
66
|
+
<div>
|
|
67
|
+
<ui-button
|
|
68
|
+
test-id="feedback-use-red-marker-button"
|
|
69
|
+
size="sm"
|
|
70
|
+
type="default"
|
|
71
|
+
variant="outline"
|
|
72
|
+
class="btn marker"
|
|
73
|
+
@click="onUseRedMarker"
|
|
74
|
+
>
|
|
75
|
+
<ui-icon
|
|
76
|
+
name="marker"
|
|
77
|
+
width="16"
|
|
78
|
+
height="16"
|
|
79
|
+
class="feedback__btn-icon"
|
|
80
|
+
/>
|
|
81
|
+
{{ localization.common.useRedMarker }}
|
|
82
|
+
</ui-button>
|
|
83
|
+
|
|
84
|
+
<ui-button
|
|
85
|
+
test-id="feedback-use-grey-marker-button"
|
|
86
|
+
size="sm"
|
|
87
|
+
type="default"
|
|
88
|
+
variant="outline"
|
|
89
|
+
class="btn eraser"
|
|
90
|
+
@click="onUseGrayEraser"
|
|
91
|
+
>
|
|
92
|
+
<ui-icon
|
|
93
|
+
name="grey-eraser"
|
|
94
|
+
width="16"
|
|
95
|
+
height="16"
|
|
96
|
+
class="feedback__btn-icon"
|
|
97
|
+
/>
|
|
98
|
+
{{ localization.common.useGrayEraser }}
|
|
99
|
+
</ui-button>
|
|
100
|
+
<ui-button
|
|
101
|
+
test-id="feedback-undo-button"
|
|
102
|
+
size="sm"
|
|
103
|
+
type="default"
|
|
104
|
+
variant="outline"
|
|
105
|
+
class="btn undo"
|
|
106
|
+
@click="onUndoLast"
|
|
107
|
+
>
|
|
108
|
+
<ui-icon
|
|
109
|
+
name="reset"
|
|
110
|
+
width="16"
|
|
111
|
+
height="16"
|
|
112
|
+
class="feedback__btn-icon"
|
|
113
|
+
/>
|
|
114
|
+
{{ localization.common.undo }}
|
|
115
|
+
</ui-button>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<ui-button
|
|
119
|
+
test-id="feedback-clear-all-button"
|
|
120
|
+
size="sm"
|
|
121
|
+
type="default"
|
|
122
|
+
variant="outline"
|
|
123
|
+
class="btn clear-all"
|
|
124
|
+
@click="clearAll"
|
|
125
|
+
>
|
|
126
|
+
<ui-icon
|
|
127
|
+
name="delete"
|
|
128
|
+
width="16"
|
|
129
|
+
height="16"
|
|
130
|
+
class="feedback__btn-icon"
|
|
131
|
+
/>
|
|
132
|
+
{{ localization.common.clearAll }}
|
|
133
|
+
</ui-button>
|
|
134
|
+
</div>
|
|
135
|
+
|
|
65
136
|
<div
|
|
66
137
|
id="feedbackImgWrap"
|
|
67
138
|
ref="feedbackImgWrap"
|
|
@@ -139,8 +210,11 @@ const memoryParentMain = ref<string>('')
|
|
|
139
210
|
const drawingArray: any = []
|
|
140
211
|
// const indexArray = 0 // index of feedbackImg itself
|
|
141
212
|
const indexArray = ref<number>(0) // index of feedbackImg itself
|
|
142
|
-
|
|
143
|
-
|
|
213
|
+
let isDrawing = false
|
|
214
|
+
let startDrawingX: number | null = null
|
|
215
|
+
let startDrawingY: number | null = null
|
|
216
|
+
let drawColor = ''
|
|
217
|
+
let drawWidth = ''
|
|
144
218
|
|
|
145
219
|
const onTakeScreenshot = (): void => {
|
|
146
220
|
optionsModel.value.hasTakeScreenshot = true
|
|
@@ -230,6 +304,63 @@ const onUploadFile = (): void => {
|
|
|
230
304
|
}
|
|
231
305
|
}
|
|
232
306
|
|
|
307
|
+
const start = (event: MouseEvent): void => {
|
|
308
|
+
if (!drawColor) return
|
|
309
|
+
const context = feedbackImg.value.getContext('2d')
|
|
310
|
+
const canvasCoordinates = feedbackImg.value.getBoundingClientRect()
|
|
311
|
+
startDrawingX = event.pageX - canvasCoordinates.left
|
|
312
|
+
startDrawingY = event.pageY - canvasCoordinates.top
|
|
313
|
+
isDrawing = true
|
|
314
|
+
context.beginPath()
|
|
315
|
+
context.moveTo(
|
|
316
|
+
event.pageX - canvasCoordinates.left,
|
|
317
|
+
event.pageY - canvasCoordinates.top
|
|
318
|
+
)
|
|
319
|
+
event.preventDefault()
|
|
320
|
+
}
|
|
321
|
+
const draw = (event: MouseEvent): void => {
|
|
322
|
+
if (!drawColor) return
|
|
323
|
+
const context = feedbackImg.value.getContext('2d')
|
|
324
|
+
const canvasCoordinates = feedbackImg.value.getBoundingClientRect()
|
|
325
|
+
if (!isDrawing) return
|
|
326
|
+
context.lineTo(
|
|
327
|
+
event.pageX - canvasCoordinates.left,
|
|
328
|
+
event.pageY - canvasCoordinates.top
|
|
329
|
+
)
|
|
330
|
+
context.strokeStyle = drawColor
|
|
331
|
+
context.lineWidth = drawWidth
|
|
332
|
+
context.lineCap = 'round'
|
|
333
|
+
context.lineJoin = 'round'
|
|
334
|
+
context.stroke()
|
|
335
|
+
event.preventDefault()
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const stop = (event: MouseEvent): void => {
|
|
339
|
+
if (!drawColor) return
|
|
340
|
+
|
|
341
|
+
const context = feedbackImg.value.getContext('2d')
|
|
342
|
+
const canvasCoordinates = feedbackImg.value.getBoundingClientRect()
|
|
343
|
+
if (!isDrawing) return
|
|
344
|
+
|
|
345
|
+
context.stroke()
|
|
346
|
+
context.closePath()
|
|
347
|
+
isDrawing = false
|
|
348
|
+
event.preventDefault()
|
|
349
|
+
if (
|
|
350
|
+
startDrawingX !== event.pageX - canvasCoordinates.left &&
|
|
351
|
+
startDrawingY !== event.pageY - canvasCoordinates.top
|
|
352
|
+
) {
|
|
353
|
+
drawingArray.push(
|
|
354
|
+
context.getImageData(
|
|
355
|
+
0,
|
|
356
|
+
0,
|
|
357
|
+
feedbackImg.value.width,
|
|
358
|
+
feedbackImg.value.height
|
|
359
|
+
)
|
|
360
|
+
)
|
|
361
|
+
indexArray.value += 1
|
|
362
|
+
}
|
|
363
|
+
}
|
|
233
364
|
const onRemoveScreenshot = (): void => {
|
|
234
365
|
optionsModel.value.hasTakeScreenshot = false
|
|
235
366
|
const parentMain = document.getElementById('feedbackId')
|
|
@@ -263,6 +394,47 @@ const clearAll = (): void => {
|
|
|
263
394
|
context.putImageData(drawingArray[indexArray.value], 0, 0)
|
|
264
395
|
}
|
|
265
396
|
}
|
|
397
|
+
|
|
398
|
+
const onUseRedMarker = (): void => {
|
|
399
|
+
drawColor = '#f76945'
|
|
400
|
+
drawWidth = '5'
|
|
401
|
+
}
|
|
402
|
+
const onUseGrayEraser = (): void => {
|
|
403
|
+
drawColor = 'lightgray'
|
|
404
|
+
drawWidth = '14'
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
const onUndoLast = (): void => {
|
|
408
|
+
drawColor = ''
|
|
409
|
+
drawWidth = ''
|
|
410
|
+
const context = feedbackImg.value.getContext('2d')
|
|
411
|
+
if (indexArray.value > 0) {
|
|
412
|
+
indexArray.value -= 1
|
|
413
|
+
drawingArray.pop()
|
|
414
|
+
context.putImageData(drawingArray[indexArray.value], 0, 0)
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
onMounted(() => {
|
|
419
|
+
feedbackImg.value.addEventListener('touchstart', start, false)
|
|
420
|
+
feedbackImg.value.addEventListener('touchmove', draw, false)
|
|
421
|
+
feedbackImg.value.addEventListener('mousedown', start, false)
|
|
422
|
+
feedbackImg.value.addEventListener('mousemove', draw, false)
|
|
423
|
+
feedbackImg.value.addEventListener('touchend', stop, false)
|
|
424
|
+
feedbackImg.value.addEventListener('mouseup', stop, false)
|
|
425
|
+
feedbackImg.value.addEventListener('mouseout', stop, false)
|
|
426
|
+
})
|
|
427
|
+
|
|
428
|
+
onBeforeUnmount(() => {
|
|
429
|
+
onRemoveScreenshot()
|
|
430
|
+
feedbackImg.value.removeEventListener('touchstart', start, false)
|
|
431
|
+
feedbackImg.value.removeEventListener('touchmove', draw, false)
|
|
432
|
+
feedbackImg.value.removeEventListener('mousedown', start, false)
|
|
433
|
+
feedbackImg.value.removeEventListener('mousemove', draw, false)
|
|
434
|
+
feedbackImg.value.removeEventListener('touchend', stop, false)
|
|
435
|
+
feedbackImg.value.removeEventListener('mouseup', stop, false)
|
|
436
|
+
feedbackImg.value.removeEventListener('mouseout', stop, false)
|
|
437
|
+
})
|
|
266
438
|
const onAnnotateImage = (): void => {
|
|
267
439
|
optionsModel.value.isAnnotateImage = true
|
|
268
440
|
}
|
|
@@ -287,6 +459,27 @@ const onAnnotateImage = (): void => {
|
|
|
287
459
|
}
|
|
288
460
|
}
|
|
289
461
|
}
|
|
462
|
+
.drawer-btn-container {
|
|
463
|
+
margin-bottom: 12px;
|
|
464
|
+
& > div {
|
|
465
|
+
display: flex;
|
|
466
|
+
align-items: center;
|
|
467
|
+
justify-content: space-between;
|
|
468
|
+
gap: 15px;
|
|
469
|
+
}
|
|
470
|
+
display: flex;
|
|
471
|
+
align-items: center;
|
|
472
|
+
justify-content: space-between;
|
|
473
|
+
|
|
474
|
+
.ui-btn {
|
|
475
|
+
width: initial;
|
|
476
|
+
|
|
477
|
+
&.clear-all {
|
|
478
|
+
color: #ea3223;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
290
483
|
&__alert {
|
|
291
484
|
margin-bottom: 16px;
|
|
292
485
|
}
|
|
@@ -295,6 +488,10 @@ const onAnnotateImage = (): void => {
|
|
|
295
488
|
width: 500px;
|
|
296
489
|
height: 280px;
|
|
297
490
|
position: relative;
|
|
491
|
+
&.annotate {
|
|
492
|
+
width: 100%;
|
|
493
|
+
height: 460px;
|
|
494
|
+
}
|
|
298
495
|
&.disabled {
|
|
299
496
|
display: none;
|
|
300
497
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bfg-common",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.393",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "nuxt build",
|
|
7
7
|
"dev": "nuxt dev --port=3002",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@vueuse/components": "^10.1.2",
|
|
36
36
|
"date-fns": "^2.29.3",
|
|
37
37
|
"bfg-nuxt-3-graph": "1.0.15",
|
|
38
|
-
"bfg-uikit": "1.0.
|
|
38
|
+
"bfg-uikit": "1.0.195",
|
|
39
39
|
"html2canvas": "^1.4.1",
|
|
40
40
|
"prettier-eslint": "^15.0.1"
|
|
41
41
|
}
|