• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

keplergl / kepler.gl / 25830234009

13 May 2026 10:31PM UTC coverage: 57.668% (-1.0%) from 58.644%
25830234009

Pull #3434

github

web-flow
Merge b10a56eba into b4790f0f5
Pull Request #3434: feat: basic annotations

7143 of 14848 branches covered (48.11%)

Branch coverage included in aggregate %.

216 of 732 new or added lines in 25 files covered. (29.51%)

74 existing lines in 3 files now uncovered.

14551 of 22771 relevant lines covered (63.9%)

77.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.27
/src/components/src/map/annotations/annotation-control.tsx
1
// SPDX-License-Identifier: MIT
2
// Copyright contributors to the kepler.gl project
3

4
import React, {useCallback, ComponentType} from 'react';
5
import {MapControls} from '@kepler.gl/types';
6
import {getApplicationConfig} from '@kepler.gl/utils';
7
import {AnnotationText} from '../../common/icons';
8
import {MapControlButton} from '../../common/styled-components';
9
import MapControlTooltipFactory from '../map-control-tooltip';
10

11
interface AnnotationControlIcons {
12
  annotationIcon: ComponentType<any>;
13
}
14

15
export type AnnotationControlProps = {
16
  mapControls: MapControls;
17
  onToggleMapControl: (control: string) => void;
18
  actionIcons?: AnnotationControlIcons;
19
};
20

21
AnnotationControlFactory.deps = [MapControlTooltipFactory];
7✔
22

23
export default function AnnotationControlFactory(
24
  MapControlTooltip: ReturnType<typeof MapControlTooltipFactory>
25
): React.FC<AnnotationControlProps> {
26
  const defaultActionIcons = {
14✔
27
    annotationIcon: AnnotationText
28
  };
29

30
  const AnnotationControl = ({
14✔
31
    mapControls,
32
    onToggleMapControl,
33
    actionIcons = defaultActionIcons
28✔
34
  }: AnnotationControlProps) => {
35
    const onClick = useCallback(
28✔
36
      event => {
NEW
37
        event.preventDefault();
×
NEW
38
        onToggleMapControl('annotation');
×
39
      },
40
      [onToggleMapControl]
41
    );
42

43
    if (!getApplicationConfig().enableAnnotations) {
28!
NEW
44
      return null;
×
45
    }
46

47
    const showControl = mapControls?.annotation?.show;
28✔
48
    if (!showControl) {
28✔
49
      return null;
5✔
50
    }
51

52
    const active = mapControls?.annotation?.active;
23✔
53
    return (
23✔
54
      <MapControlTooltip
55
        id="show-annotation"
56
        message={active ? 'tooltip.hideAnnotationPanel' : 'tooltip.showAnnotationPanel'}
23!
57
      >
58
        <MapControlButton
59
          className="map-control-button toggle-annotation"
60
          onClick={onClick}
61
          active={active}
62
        >
63
          <actionIcons.annotationIcon height="22px" />
64
        </MapControlButton>
65
      </MapControlTooltip>
66
    );
67
  };
68

69
  AnnotationControl.displayName = 'AnnotationControl';
14✔
70
  return React.memo(AnnotationControl);
14✔
71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc