# All files / components/geo/processing toolTips.ts

33.33% Statements 8/24
55.55% Branches 5/9
20% Functions 1/5
36.84% Lines 7/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    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

    3x

    3x

    6x
    3x
    3x
    1x

    3x

     // Types
    import {Axis} from '../../../types/geo'

    export const formatValue = (
      key: string,
      defaultLabel: string,
      value: number,
      Idimension: Axis = {}
    ) => {
      const {prefix = '', suffix = ''} = dimension
      const formattedValue = `${prefix}${value}${suffix}`
      if (value !== undefined && value !== null) {
        return {
          key: key,
          name: defaultLabel,
          type: 'string',
          values: [formattedValue],
        }
      }
    }

    export const defineToolTipEffect = (markerRefs, setToolTip) => {
      return () => {
        for (let i = 0; i < markerRefs.length; i++) {
          const {markerRef, rowInfo} = markerRefs[i]
          const marker = markerRef.current.leafletElement
          let mouseEntered = false
          marker.on('mouseover', () => {
            Iif (!mouseEntered) {
              setToolTip(rowInfo)
              mouseEntered = true
            }
          })
          marker.on('mouseout', () => {
            mouseEntered = false
            setToolTip(null)
          })
        }
      }
    }