bfg-common 1.4.415 → 1.4.416

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.
@@ -103,6 +103,7 @@
103
103
  type="default"
104
104
  variant="outline"
105
105
  class="btn undo"
106
+ :disabled="isDisabledButton"
106
107
  @click="onUndoLast"
107
108
  >
108
109
  <ui-icon
@@ -121,6 +122,7 @@
121
122
  type="default"
122
123
  variant="outline"
123
124
  class="btn clear-all"
125
+ :disabled="isDisabledButton"
124
126
  @click="clearAll"
125
127
  >
126
128
  <ui-icon
@@ -208,13 +210,15 @@ const memoryParentModalDialog = ref<string>('')
208
210
  const memoryParentMain = ref<string>('')
209
211
 
210
212
  const drawingArray: any = []
211
- let indexArray = 0 // index of feedbackImg itself
213
+ const indexArray = ref<number>(0) // index of feedbackImg itself
212
214
  let isDrawing = false
213
215
  let startDrawingX: number | null = null
214
216
  let startDrawingY: number | null = null
215
217
  let drawColor = ''
216
218
  let drawWidth = ''
217
219
 
220
+ const isDisabledButton = computed<boolean>(() => indexArray.value === 0)
221
+
218
222
  const onTakeScreenshot = (): void => {
219
223
  optionsModel.value.hasTakeScreenshot = true
220
224
  const value = {
@@ -247,7 +251,7 @@ const onTakeScreenshot = (): void => {
247
251
  feedbackImg.value.height
248
252
  )
249
253
  drawingArray.length = 0
250
- indexArray = 0
254
+ indexArray.value = 0
251
255
  drawingArray.push(
252
256
  context.getImageData(
253
257
  0,
@@ -276,7 +280,7 @@ const onUploadFile = (): void => {
276
280
  feedbackImg.value.height = img.height
277
281
  context.drawImage(img, 0, 0, img.width, img.height)
278
282
  drawingArray.length = 0
279
- indexArray = 0
283
+ indexArray.value = 0
280
284
  drawingArray.push(
281
285
  context.getImageData(
282
286
  0,
@@ -357,7 +361,7 @@ const stop = (event: MouseEvent): void => {
357
361
  feedbackImg.value.height
358
362
  )
359
363
  )
360
- indexArray += 1
364
+ indexArray.value += 1
361
365
  }
362
366
  }
363
367
  const onRemoveScreenshot = (): void => {
@@ -386,11 +390,11 @@ const clearAll = (): void => {
386
390
  const context = feedbackImg.value.getContext('2d')
387
391
  // drawColor = ''
388
392
  // drawWidth = ''
389
- if (indexArray <= 0) return
390
- while (indexArray > 0) {
393
+ if (indexArray.value <= 0) return
394
+ while (indexArray.value > 0) {
391
395
  drawingArray.pop()
392
- indexArray -= 1
393
- context.putImageData(drawingArray[indexArray], 0, 0)
396
+ indexArray.value -= 1
397
+ context.putImageData(drawingArray[indexArray.value], 0, 0)
394
398
  }
395
399
  }
396
400
 
@@ -407,10 +411,10 @@ const onUndoLast = (): void => {
407
411
  drawColor = ''
408
412
  drawWidth = ''
409
413
  const context = feedbackImg.value.getContext('2d')
410
- if (indexArray > 0) {
411
- indexArray -= 1
414
+ if (indexArray.value > 0) {
415
+ indexArray.value -= 1
412
416
  drawingArray.pop()
413
- context.putImageData(drawingArray[indexArray], 0, 0)
417
+ context.putImageData(drawingArray[indexArray.value], 0, 0)
414
418
  }
415
419
  }
416
420
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.415",
4
+ "version": "1.4.416",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",