File size: 18,554 Bytes
2964111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
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
441
442
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
552
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
<template>
  <div 
    class="video-frame-container" 
    tabindex="0" 
    ref="container"
    @keydown="handleKeyDown"
    @focus="handleFocus"
    @blur="handleBlur">
    <div class="video-frame" 
         ref="imageContainer"
         :style="frameStyle"
         @contextmenu.prevent
         @wheel.prevent="handleZoom"
         @mousedown="handleMouseDown"
         @mousemove="handleMouseMove"
         @mouseup="stopPan"
         @mouseleave="stopPan">
      <div class="image-container" :style="transformStyle">
        <img v-if="thumbnail" 
             :src="thumbnail" 
             alt="Video frame"
             @load="initializeImage"
             ref="image"
             class="video-image" />
        <div v-for="(point, index) in calibrationPoints" 
             :key="index"
             class="calibration-point"
             :class="{ 'selected-point': selectedFieldPoint && Number(selectedFieldPoint.index) === Number(index) }"
             :style="{

               left: `${point.x}px`,

               top: `${point.y}px`

             }">
        </div>
        <div v-for="(line, id) in calibrationLines"
             :key="'line-'+id"
             class="calibration-polyline">
          <svg class="polyline-svg">
            <g v-for="(line, id) in calibrationLines" :key="id">
              <polyline
                :points="formatPoints(line.points)"
                :class="{ 'selected-line': selectedFieldLine && selectedFieldLine.id === id }"
                fill="none"
                stroke="#00FF15"
                stroke-width="2"
              />
              <circle v-for="(point, index) in line.points"
                      :key="'point-'+index"
                      :cx="point.x"
                      :cy="point.y"
                      r="2"
                      class="polyline-point"
                      :class="{

                        'selected-line-point': selectedFieldLine && selectedFieldLine.id === id,

                        'dragging': isDraggingPoint && draggedLineId === id && selectedPointIndex === index,

                        'shared-point': sharedPoints.has(`${id}-${index}`),

                        'hoverable': isCtrlPressed && selectedFieldLine

                      }"
              />
            </g>
          </svg>
        </div>
        <div v-for="(point, index) in currentLinePoints"
             :key="'temp-'+index"
             class="calibration-point temp-point"
             :style="{

               left: `${point.x}px`,

               top: `${point.y}px`

             }" />
        <svg class="temp-polyline-svg" v-if="currentLinePoints.length > 0">
          <polyline
            :points="getPolylinePoints(currentLinePoints)"
            stroke="#FFC107"
            stroke-dasharray="5,5"
            fill="none"
            stroke-width="2"
          />
        </svg>
      </div>
    </div>
    <div class="save-section">
      <KeyboardShortcuts />
      <button 
        class="action-btn clear-btn"
        :disabled="Object.keys(calibrationLines).length === 0 && Object.keys(calibrationPoints).length === 0"
        @click="clearCalibration"
      >
        Clear
      </button>
      <button 
        class="action-btn process-btn"
        :disabled="Object.keys(calibrationLines).length === 0 && Object.keys(calibrationPoints).length === 0"
        @click="processCalibration"
      >
        Traiter la calibration
      </button>
    </div>
  </div>
</template>

<script setup>
import { ref, computed, onMounted, onUnmounted } from 'vue'
import KeyboardShortcuts from './KeyboardShortcuts.vue'

// Props
const props = defineProps({
  thumbnail: {
    type: String,
    default: null
  },
  calibrationPoints: {
    type: Object,
    default: () => ({})
  },
  calibrationLines: {
    type: Object,
    default: () => ({})
  },
  selectedFieldPoint: {
    type: Object,
    default: null
  },
  selectedFieldLine: {
    type: Object,
    default: null
  }
})

// Emits
const emit = defineEmits([
  'update:calibrationPoints',
  'update:calibrationLines',
  'update:selectedFieldPoint',
  'update:selectedFieldLine',
  'clear-calibration',
  'process-calibration'
])

// Refs
const container = ref(null)
const imageContainer = ref(null)
const image = ref(null)

// Data
const scale = ref(1)
const translation = ref({ x: 0, y: 0 })
const aspectRatio = ref(1)
const imageSize = ref({ width: 0, height: 0 })
const isPanning = ref(false)
const isMiddleMouseDown = ref(false)
const lastMousePosition = ref({ x: 0, y: 0 })
const currentLinePoints = ref([])
const isDrawingLine = ref(false)
const isDraggingPoint = ref(false)
const selectedPointIndex = ref(null)
const draggedLineId = ref(null)
const proximityThreshold = ref(10)
const tempPoint = ref(null)
const isCtrlPressed = ref(false)
const sharedPoints = ref(new Set())
const draggedPoints = ref([])
const isCreatingLine = ref(false)

// Computed
const frameStyle = computed(() => {
  if (!aspectRatio.value) return {}
  
  const container = imageContainer.value?.parentElement
  if (!container) return {}
  
  const parentWidth = container.clientWidth
  const parentHeight = container.clientHeight
  
  let width, height
  
  if (parentWidth / parentHeight > aspectRatio.value) {
    height = parentHeight
    width = height * aspectRatio.value
  } else {
    width = parentWidth
    height = width / aspectRatio.value
  }
  
  return {
    width: `${width}px`,
    height: `${height}px`
  }
})

const transformStyle = computed(() => {
  return {
    transform: `translate(${translation.value.x}px, ${translation.value.y}px) scale(${scale.value})`,
    transformOrigin: '0 0'
  }
})

// Methods
const initializeImage = (event) => {
  const img = event.target
  
  imageSize.value = {
    width: img.naturalWidth,
    height: img.naturalHeight
  }
  
  aspectRatio.value = imageSize.value.width / imageSize.value.height
}

const handleZoom = (event) => {
  const zoomFactor = 0.1
  const delta = Math.sign(event.deltaY) * -1
  const newScale = scale.value + delta * zoomFactor
  
  const oldScale = scale.value
  scale.value = Math.min(Math.max(newScale, 1), 15)
  
  if (scale.value === 1) {
    translation.value = { x: 0, y: 0 }
    return
  }
  
  if (scale.value !== oldScale) {
    const rect = imageContainer.value.getBoundingClientRect()
    const mouseX = event.clientX - rect.left
    const mouseY = event.clientY - rect.top

    const pointX = (mouseX - translation.value.x) / oldScale
    const pointY = (mouseY - translation.value.y) / oldScale

    translation.value = {
      x: mouseX - (pointX * scale.value),
      y: mouseY - (pointY * scale.value)
    }
  }
}

const handleMouseDown = (event) => {
  if (event.button === 1) { // Clic molette
    isMiddleMouseDown.value = true
    lastMousePosition.value = {
      x: event.clientX,
      y: event.clientY
    }
    event.preventDefault()
    return
  }

  // Gestion des points
  if (event.button === 0 && props.selectedFieldPoint) {
    const rect = imageContainer.value.getBoundingClientRect()
    const x = event.clientX - rect.left
    const y = event.clientY - rect.top
    
    const newPoints = { ...props.calibrationPoints }
    newPoints[props.selectedFieldPoint.index] = {
      x: (x - translation.value.x) / scale.value,
      y: (y - translation.value.y) / scale.value
    }
    emit('update:calibrationPoints', newPoints)
    return
  }

  // Gestion des lignes
  if (event.button === 2 && props.selectedFieldLine) {
    if (currentLinePoints.value.length >= 2) {
      const newLines = { ...props.calibrationLines }
      newLines[props.selectedFieldLine.id] = {
        points: [...currentLinePoints.value]
      }
      emit('update:calibrationLines', newLines)
      currentLinePoints.value = []
      isCreatingLine.value = false
    }
    return
  }

  if (event.button === 0) {
    const rect = imageContainer.value.getBoundingClientRect()
    const mouseX = event.clientX - rect.left
    const mouseY = event.clientY - rect.top
    
    const x = (mouseX - translation.value.x) / scale.value
    const y = (mouseY - translation.value.y) / scale.value

    if (isDraggingPoint.value) {
      const newLines = { ...props.calibrationLines }
      draggedPoints.value.forEach(({ lineId, pointIndex }) => {
        if (newLines[lineId] && Array.isArray(newLines[lineId].points)) {
          newLines[lineId].points[pointIndex] = { x, y }
        }
      })
      emit('update:calibrationLines', newLines)
      
      isDraggingPoint.value = false
      draggedPoints.value = []
      tempPoint.value = null
      return
    }

    if (!isCreatingLine.value) {
      if (isCtrlPressed.value) {
        const nearestPoint = findLineByPoint(x, y)
        
        if (nearestPoint) {
          if (currentLinePoints.value.length === 0) {
            isCreatingLine.value = true
            currentLinePoints.value.push(nearestPoint.point)
            sharedPoints.value.add(`${nearestPoint.lineId}-${nearestPoint.pointIndex}`)
            return
          }
        }
      }
      
      const nearestPoint = findLineByPoint(x, y)
      if (nearestPoint) {
        isDraggingPoint.value = true
        const sharedLines = findAllLinesWithPoint(nearestPoint.point.x, nearestPoint.point.y)
        draggedPoints.value = sharedLines.map(line => ({
          lineId: line.lineId,
          pointIndex: line.pointIndex
        }))
        tempPoint.value = { ...nearestPoint.point }
        return
      } else if (props.selectedFieldLine) {
        isCreatingLine.value = true
        currentLinePoints.value = [{ x, y }]
      }
    } else {
      if (isCtrlPressed.value) {
        const nearestPoint = findLineByPoint(x, y)
        if (nearestPoint && nearestPoint.lineId !== props.selectedFieldLine.id) {
          currentLinePoints.value.push(nearestPoint.point)
          sharedPoints.value.add(`${nearestPoint.lineId}-${nearestPoint.pointIndex}`)
          return
        }
      }
      currentLinePoints.value.push({ x, y })
    }
  }
}

const handleMouseMove = (event) => {
  if (isMiddleMouseDown.value) {
    const dx = event.clientX - lastMousePosition.value.x
    const dy = event.clientY - lastMousePosition.value.y
    
    const container = imageContainer.value
    const img = image.value
    
    if (!container || !img) return
    
    const containerRect = container.getBoundingClientRect()
    const imageRect = img.getBoundingClientRect()
    
    const minX = containerRect.width - imageRect.width * scale.value
    const minY = containerRect.height - imageRect.height * scale.value
    
    const newX = Math.min(0, Math.max(minX, translation.value.x + dx))
    const newY = Math.min(0, Math.max(minY, translation.value.y + dy))
    
    translation.value.x = newX
    translation.value.y = newY
    
    lastMousePosition.value = {
      x: event.clientX,
      y: event.clientY
    }
    return
  }

  if (isDraggingPoint.value && draggedPoints.value.length > 0) {
    const rect = imageContainer.value.getBoundingClientRect()
    const mouseX = event.clientX - rect.left
    const mouseY = event.clientY - rect.top
    
    const x = (mouseX - translation.value.x) / scale.value
    const y = (mouseY - translation.value.y) / scale.value

    const newLines = { ...props.calibrationLines }
    draggedPoints.value.forEach(({ lineId, pointIndex }) => {
      if (newLines[lineId] && Array.isArray(newLines[lineId].points)) {
        newLines[lineId].points[pointIndex] = { x, y }
      }
    })
    
    emit('update:calibrationLines', newLines)
  }
}

const stopPan = () => {
  isMiddleMouseDown.value = false
}

const handleKeyDown = (event) => {
  if (event.key === 'Control') {
    isCtrlPressed.value = true
  } else if (event.key === 'Delete' || event.key === 'Backspace') {
    deleteLine()
  }
}

const handleKeyUp = (event) => {
  if (event.key === 'Control') {
    isCtrlPressed.value = false
  }
}

const handleFocus = () => {
  console.log('Container focused')
}

const handleBlur = () => {
  console.log('Container lost focus')
}

const getPolylinePoints = (points) => {
  if (!points) return ''
  return points.map(p => `${p.x},${p.y}`).join(' ')
}

const formatPoints = (points) => {
  if (!points) return ''
  return points.map(p => `${p.x},${p.y}`).join(' ')
}

const findLineByPoint = (x, y) => {
  for (const [lineId, line] of Object.entries(props.calibrationLines)) {
    const points = line.points
    for (let i = 0; i < points.length; i++) {
      const point = points[i]
      const dx = point.x - x
      const dy = point.y - y
      const distance = Math.sqrt(dx * dx + dy * dy)
      
      if (distance < proximityThreshold.value) {
        return {
          lineId,
          pointIndex: i,
          point
        }
      }
    }
  }
  return null
}

const findAllLinesWithPoint = (x, y) => {
  const sharedLines = []
  for (const [lineId, line] of Object.entries(props.calibrationLines)) {
    const points = line.points
    for (let i = 0; i < points.length; i++) {
      const point = points[i]
      const dx = point.x - x
      const dy = point.y - y
      const distance = Math.sqrt(dx * dx + dy * dy)
      
      if (distance < proximityThreshold.value) {
        sharedLines.push({
          lineId,
          pointIndex: i,
          point
        })
      }
    }
  }
  return sharedLines
}

const deleteLine = () => {
  if (props.selectedFieldLine) {
    const newLines = { ...props.calibrationLines }
    if (newLines[props.selectedFieldLine.id]) {
      const points = newLines[props.selectedFieldLine.id].points
      points.forEach((_, index) => {
        sharedPoints.value.delete(`${props.selectedFieldLine.id}-${index}`)
      })
    }
    delete newLines[props.selectedFieldLine.id]
    emit('update:calibrationLines', newLines)
    emit('update:selectedFieldLine', null)
    currentLinePoints.value = []
    isCreatingLine.value = false
  }
}

const clearCalibration = () => {
  emit('clear-calibration')
}

const processCalibration = () => {
  emit('process-calibration')
}

// Lifecycle
onMounted(() => {
  window.addEventListener('keydown', handleKeyDown)
  window.addEventListener('keyup', handleKeyUp)
})

onUnmounted(() => {
  window.removeEventListener('keydown', handleKeyDown)
  window.removeEventListener('keyup', handleKeyUp)
})

// Expose imageSize for parent component
defineExpose({
  imageSize
})
</script>

<style scoped>
.video-frame-container {
  flex: 2;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 0;
  border-radius: 4px;
  padding: 10px;
  outline: none;
}

.video-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: calc(100% - 50px);
  margin-bottom: 45px;
}

.image-container {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}

.video-image {
  display: block;
  max-width: 100%;
  height: auto;
}

.calibration-point {
  position: absolute;
  width: 12px;
  height: 12px;
  background-color: rgb(0, 255, 21);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.8),
              0 0 12px rgba(76, 175, 80, 0.5);
}

.selected-point {
  background-color: #FFC107;
  box-shadow: 0 0 8px rgba(255, 193, 7, 0.8),
              0 0 15px rgba(255, 193, 7, 0.5);
}

.save-section {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: flex;
  gap: 10px;
}

.action-btn {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid #555;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.action-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(217, 255, 4, 0.2);
}

.action-btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: #666;
  border-color: #333;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.process-btn {
  background: var(--color-primary);
  color: var(--color-secondary);
  border-color: var(--color-primary);
}

.process-btn:hover:not(:disabled) {
  background: var(--color-primary-soft);
  border-color: var(--color-primary-soft);
  color: var(--color-secondary);
  box-shadow: 0 4px 15px rgba(217, 255, 4, 0.4);
}

.calibration-polyline {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.polyline-svg {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.polyline-svg polyline {
  transition: stroke-width 0.2s;
}

.selected-line {
  stroke-width: 2;
  stroke: #FFC107 !important;
}

.polyline-point {
  fill: #00FF15;
  stroke: white;
  stroke-width: 0.5;
  transition: all 0.2s ease;
  pointer-events: all;
  cursor: pointer;
}

.polyline-point:hover {
  fill: #FFC107;
  r: 3;
  stroke-width: 2;
}

.selected-line .polyline-point {
  cursor: grab;
}

.polyline-point.dragging {
  fill: #FF4081;
  r: 4;
  stroke-width: 3;
}

.selected-line-point {
  fill: #FFC107;
  r: 2;
  stroke-width: 1;
}

.temp-point {
  background-color: #FFC107;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid white;
  z-index: 2;
}

.temp-polyline-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.polyline-point.shared-point {
  fill: #FFC107;
  stroke: #FF4081;
  stroke-width: 2;
  r: 4;
  animation: pulse 2s infinite;
}

.polyline-point.hoverable {
  cursor: pointer;
  filter: brightness(1.2);
}

@keyframes pulse {
  0% {
    stroke-width: 2;
    stroke-opacity: 1;
  }
  50% {
    stroke-width: 3;
    stroke-opacity: 0.5;
  }
  100% {
    stroke-width: 2;
    stroke-opacity: 1;
  }
}
</style>