@unovis/ts 1.1.1-beta.6 → 1.1.1-beta.7
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/declaration.d.ts +1 -0
- package/index.ts +1 -0
- package/licences.txt +43 -0
- package/maps.ts +1 -0
- package/package.json +1 -1
- package/rollup.config.js +71 -0
- package/rules/ts-getter-setter.js +35 -0
- package/src/components/area/config.ts +29 -0
- package/src/components/area/index.ts +133 -0
- package/{components/area/style.js → src/components/area/style.ts} +9 -10
- package/src/components/area/types.ts +2 -0
- package/src/components/axis/config.ts +76 -0
- package/src/components/axis/index.ts +363 -0
- package/{components/axis/style.js → src/components/axis/style.ts} +27 -22
- package/src/components/axis/types.ts +4 -0
- package/src/components/brush/config.ts +51 -0
- package/src/components/brush/index.ts +233 -0
- package/{components/brush/style.js → src/components/brush/style.ts} +15 -14
- package/src/components/brush/types.ts +8 -0
- package/src/components/bullet-legend/config.ts +38 -0
- package/src/components/bullet-legend/index.ts +104 -0
- package/{components/bullet-legend/style.js → src/components/bullet-legend/style.ts} +18 -16
- package/src/components/bullet-legend/types.ts +7 -0
- package/src/components/chord-diagram/config.ts +53 -0
- package/src/components/chord-diagram/index.ts +401 -0
- package/src/components/chord-diagram/modules/label.ts +155 -0
- package/src/components/chord-diagram/modules/link.ts +91 -0
- package/src/components/chord-diagram/modules/node.ts +80 -0
- package/{components/chord-diagram/style.js → src/components/chord-diagram/style.ts} +39 -30
- package/src/components/chord-diagram/types.ts +68 -0
- package/src/components/crosshair/config.ts +48 -0
- package/src/components/crosshair/index.ts +220 -0
- package/{components/crosshair/style.js → src/components/crosshair/style.ts} +12 -12
- package/src/components/crosshair/types.ts +15 -0
- package/src/components/donut/config.ts +65 -0
- package/src/components/donut/index.ts +148 -0
- package/src/components/donut/modules/arc.ts +86 -0
- package/{components/donut/style.js → src/components/donut/style.ts} +20 -18
- package/src/components/donut/types.ts +17 -0
- package/src/components/flow-legend/config.ts +31 -0
- package/src/components/flow-legend/index.ts +103 -0
- package/{components/flow-legend/style.js → src/components/flow-legend/style.ts} +25 -21
- package/src/components/flow-legend/types.ts +10 -0
- package/src/components/free-brush/config.ts +54 -0
- package/src/components/free-brush/index.ts +207 -0
- package/{components/free-brush/style.js → src/components/free-brush/style.ts} +12 -12
- package/src/components/free-brush/types.ts +8 -0
- package/src/components/graph/config.ts +280 -0
- package/src/components/graph/index.ts +809 -0
- package/src/components/graph/modules/layout-helpers.ts +96 -0
- package/src/components/graph/modules/layout.ts +502 -0
- package/src/components/graph/modules/link/helper.ts +105 -0
- package/src/components/graph/modules/link/index.ts +302 -0
- package/{components/graph/modules/link/style.js → src/components/graph/modules/link/style.ts} +45 -34
- package/src/components/graph/modules/node/helper.ts +162 -0
- package/src/components/graph/modules/node/index.ts +343 -0
- package/{components/graph/modules/node/style.js → src/components/graph/modules/node/style.ts} +72 -52
- package/src/components/graph/modules/panel/helper.ts +160 -0
- package/src/components/graph/modules/panel/index.ts +137 -0
- package/{components/graph/modules/panel/style.js → src/components/graph/modules/panel/style.ts} +42 -32
- package/src/components/graph/modules/shape.ts +108 -0
- package/src/components/graph/modules/zoom-levels.ts +6 -0
- package/src/components/graph/style.ts +72 -0
- package/src/components/graph/types.ts +152 -0
- package/src/components/grouped-bar/config.ts +40 -0
- package/src/components/grouped-bar/index.ts +325 -0
- package/{components/grouped-bar/style.js → src/components/grouped-bar/style.ts} +15 -14
- package/src/components/leaflet-flow-map/config.ts +60 -0
- package/src/components/leaflet-flow-map/index.ts +279 -0
- package/src/components/leaflet-flow-map/renderer-utils.ts +14 -0
- package/src/components/leaflet-flow-map/renderer.ts +146 -0
- package/{components/leaflet-flow-map/shaders.js → src/components/leaflet-flow-map/shaders.ts} +4 -7
- package/src/components/leaflet-flow-map/types.ts +18 -0
- package/src/components/leaflet-map/config.ts +234 -0
- package/src/components/leaflet-map/index.ts +808 -0
- package/src/components/leaflet-map/leaflet.css +625 -0
- package/src/components/leaflet-map/modules/clusterBackground.ts +34 -0
- package/src/components/leaflet-map/modules/donut.ts +37 -0
- package/src/components/leaflet-map/modules/map.ts +178 -0
- package/src/components/leaflet-map/modules/node.ts +208 -0
- package/src/components/leaflet-map/modules/selectionRing.ts +63 -0
- package/src/components/leaflet-map/modules/utils.ts +290 -0
- package/{components → src/components}/leaflet-map/renderer/leaflet-maplibre-gl.js +76 -78
- package/src/components/leaflet-map/renderer/map-style.ts +24 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json +35 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json +35 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json +2185 -0
- package/src/components/leaflet-map/renderer/mapboxgl-layer.ts +43 -0
- package/src/components/leaflet-map/renderer/mapboxgl-utils.ts +40 -0
- package/{components → src/components}/leaflet-map/renderer/maplibre-gl.css.js +2 -4
- package/src/components/leaflet-map/style.ts +217 -0
- package/src/components/leaflet-map/types.ts +75 -0
- package/src/components/line/config.ts +34 -0
- package/src/components/line/index.ts +188 -0
- package/{components/line/style.js → src/components/line/style.ts} +18 -16
- package/src/components/line/types.ts +3 -0
- package/src/components/nested-donut/config.ts +75 -0
- package/src/components/nested-donut/index.ts +176 -0
- package/src/components/nested-donut/modules/arc.ts +78 -0
- package/src/components/nested-donut/modules/label.ts +63 -0
- package/src/components/nested-donut/style.ts +82 -0
- package/src/components/nested-donut/types.ts +29 -0
- package/src/components/sankey/config.ts +195 -0
- package/src/components/sankey/index.ts +387 -0
- package/src/components/sankey/modules/label.ts +228 -0
- package/src/components/sankey/modules/link.ts +141 -0
- package/src/components/sankey/modules/node.ts +221 -0
- package/{components/sankey/style.js → src/components/sankey/style.ts} +60 -44
- package/src/components/sankey/types.ts +95 -0
- package/src/components/scatter/config.ts +49 -0
- package/src/components/scatter/index.ts +220 -0
- package/src/components/scatter/modules/point.ts +123 -0
- package/src/components/scatter/modules/utils.ts +150 -0
- package/{components/scatter/style.js → src/components/scatter/style.ts} +15 -14
- package/src/components/scatter/types.ts +21 -0
- package/src/components/stacked-bar/config.ts +42 -0
- package/src/components/stacked-bar/index.ts +267 -0
- package/{components/stacked-bar/style.js → src/components/stacked-bar/style.ts} +15 -14
- package/src/components/stacked-bar/types.ts +5 -0
- package/src/components/timeline/config.ts +49 -0
- package/src/components/timeline/index.ts +302 -0
- package/{components/timeline/style.js → src/components/timeline/style.ts} +39 -30
- package/src/components/tooltip/config.ts +69 -0
- package/src/components/tooltip/index.ts +220 -0
- package/{components → src/components}/tooltip/style.js +11 -14
- package/src/components/topojson-map/config.ts +124 -0
- package/src/components/topojson-map/index.ts +436 -0
- package/{components/topojson-map/style.js → src/components/topojson-map/style.ts} +33 -26
- package/src/components/topojson-map/types.ts +123 -0
- package/src/components/topojson-map/utils.ts +29 -0
- package/src/components/vis-controls/config.ts +16 -0
- package/src/components/vis-controls/index.ts +68 -0
- package/{components/vis-controls/style.js → src/components/vis-controls/style.ts} +34 -27
- package/src/components/vis-controls/types.ts +14 -0
- package/src/components/xy-labels/config.ts +56 -0
- package/src/components/xy-labels/index.ts +109 -0
- package/src/components/xy-labels/modules/label.ts +140 -0
- package/{components/xy-labels/style.js → src/components/xy-labels/style.ts} +15 -14
- package/src/components/xy-labels/types.ts +26 -0
- package/src/components.ts +56 -0
- package/src/containers/single-container/config.ts +15 -0
- package/src/containers/single-container/index.ts +150 -0
- package/src/containers/xy-container/config.ts +112 -0
- package/src/containers/xy-container/index.ts +407 -0
- package/src/containers.ts +6 -0
- package/src/core/component/config.ts +61 -0
- package/src/core/component/index.ts +154 -0
- package/src/core/component/types.ts +9 -0
- package/src/core/config/index.ts +12 -0
- package/src/core/container/config.ts +56 -0
- package/src/core/container/index.ts +136 -0
- package/src/core/xy-component/config.ts +46 -0
- package/src/core/xy-component/index.ts +90 -0
- package/src/data-models/core.ts +15 -0
- package/src/data-models/graph.ts +138 -0
- package/src/data-models/map-graph.ts +72 -0
- package/src/data-models/map.ts +18 -0
- package/src/data-models/series.ts +16 -0
- package/src/index.ts +7 -0
- package/src/maps/china-provinces.json +1 -0
- package/src/maps/fr-regions.json +1 -0
- package/src/maps/germany-regions.json +1 -0
- package/src/maps/ind-regions.json +1 -0
- package/src/maps/uk-regions.json +1 -0
- package/src/maps/us-counties.json +1 -0
- package/src/maps/us-states.json +1 -0
- package/src/maps/world-110m-alpha.json +1 -0
- package/src/maps/world-simple.json +1 -0
- package/src/maps/world-simplest.json +1 -0
- package/src/maps.ts +34 -0
- package/src/styles/colors.ts +28 -0
- package/src/styles/index.ts +38 -0
- package/{styles/sizes.js → src/styles/sizes.ts} +6 -8
- package/src/types/accessor.ts +5 -0
- package/src/types/component.ts +15 -0
- package/src/types/curve.ts +62 -0
- package/src/types/data.ts +5 -0
- package/src/types/direction.ts +6 -0
- package/src/types/graph.ts +40 -0
- package/src/types/map.ts +5 -0
- package/src/types/misc.ts +10 -0
- package/src/types/position.ts +23 -0
- package/src/types/scale.ts +47 -0
- package/src/types/shape.ts +7 -0
- package/src/types/spacing.ts +6 -0
- package/src/types/svg.ts +32 -0
- package/src/types/symbol.ts +21 -0
- package/src/types/text.ts +71 -0
- package/src/types.ts +31 -0
- package/src/utils/color.ts +41 -0
- package/src/utils/d3.ts +15 -0
- package/src/utils/data.ts +328 -0
- package/src/utils/html.ts +13 -0
- package/src/utils/map.ts +29 -0
- package/src/utils/misc.ts +54 -0
- package/src/utils/path.ts +196 -0
- package/src/utils/scale.ts +1 -0
- package/src/utils/style.ts +37 -0
- package/src/utils/svg.ts +49 -0
- package/src/utils/text.ts +529 -0
- package/src/utils/type.ts +9 -0
- package/tsconfig.json +29 -0
- package/components/area/config.d.ts +0 -25
- package/components/area/config.js +0 -16
- package/components/area/config.js.map +0 -1
- package/components/area/index.d.ts +0 -19
- package/components/area/index.js +0 -102
- package/components/area/index.js.map +0 -1
- package/components/area/style.d.ts +0 -3
- package/components/area/style.js.map +0 -1
- package/components/area/types.d.ts +0 -6
- package/components/axis/config.d.ts +0 -71
- package/components/axis/config.js +0 -32
- package/components/axis/config.js.map +0 -1
- package/components/axis/index.d.ts +0 -44
- package/components/axis/index.js +0 -305
- package/components/axis/index.js.map +0 -1
- package/components/axis/style.d.ts +0 -9
- package/components/axis/style.js.map +0 -1
- package/components/axis/types.d.ts +0 -4
- package/components/axis/types.js +0 -8
- package/components/axis/types.js.map +0 -1
- package/components/brush/config.d.ts +0 -42
- package/components/brush/config.js +0 -24
- package/components/brush/config.js.map +0 -1
- package/components/brush/index.d.ts +0 -28
- package/components/brush/index.js +0 -199
- package/components/brush/index.js.map +0 -1
- package/components/brush/style.d.ts +0 -5
- package/components/brush/style.js.map +0 -1
- package/components/brush/types.d.ts +0 -7
- package/components/brush/types.js +0 -8
- package/components/brush/types.js.map +0 -1
- package/components/bullet-legend/config.d.ts +0 -34
- package/components/bullet-legend/config.js +0 -16
- package/components/bullet-legend/config.js.map +0 -1
- package/components/bullet-legend/index.d.ts +0 -19
- package/components/bullet-legend/index.js +0 -79
- package/components/bullet-legend/index.js.map +0 -1
- package/components/bullet-legend/style.d.ts +0 -6
- package/components/bullet-legend/style.js.map +0 -1
- package/components/bullet-legend/types.d.ts +0 -7
- package/components/bullet-legend/types.js +0 -2
- package/components/bullet-legend/types.js.map +0 -1
- package/components/chord-diagram/config.d.ts +0 -44
- package/components/chord-diagram/config.js +0 -25
- package/components/chord-diagram/config.js.map +0 -1
- package/components/chord-diagram/index.d.ts +0 -42
- package/components/chord-diagram/index.js +0 -305
- package/components/chord-diagram/index.js.map +0 -1
- package/components/chord-diagram/modules/label.d.ts +0 -8
- package/components/chord-diagram/modules/label.js +0 -115
- package/components/chord-diagram/modules/label.js.map +0 -1
- package/components/chord-diagram/modules/link.d.ts +0 -21
- package/components/chord-diagram/modules/link.js +0 -63
- package/components/chord-diagram/modules/link.js.map +0 -1
- package/components/chord-diagram/modules/node.d.ts +0 -17
- package/components/chord-diagram/modules/node.js +0 -52
- package/components/chord-diagram/modules/node.js.map +0 -1
- package/components/chord-diagram/style.d.ts +0 -13
- package/components/chord-diagram/style.js.map +0 -1
- package/components/chord-diagram/types.d.ts +0 -58
- package/components/chord-diagram/types.js +0 -8
- package/components/chord-diagram/types.js.map +0 -1
- package/components/crosshair/config.d.ts +0 -43
- package/components/crosshair/config.js +0 -19
- package/components/crosshair/config.js.map +0 -1
- package/components/crosshair/index.d.ts +0 -35
- package/components/crosshair/index.js +0 -183
- package/components/crosshair/index.js.map +0 -1
- package/components/crosshair/style.d.ts +0 -4
- package/components/crosshair/style.js.map +0 -1
- package/components/crosshair/types.d.ts +0 -13
- package/components/crosshair/types.js +0 -2
- package/components/crosshair/types.js.map +0 -1
- package/components/donut/config.d.ts +0 -59
- package/components/donut/config.js +0 -28
- package/components/donut/config.js.map +0 -1
- package/components/donut/index.d.ts +0 -21
- package/components/donut/index.js +0 -107
- package/components/donut/index.js.map +0 -1
- package/components/donut/modules/arc.d.ts +0 -10
- package/components/donut/modules/arc.js +0 -59
- package/components/donut/modules/arc.js.map +0 -1
- package/components/donut/style.d.ts +0 -7
- package/components/donut/style.js.map +0 -1
- package/components/donut/types.d.ts +0 -20
- package/components/flow-legend/config.d.ts +0 -29
- package/components/flow-legend/config.js +0 -18
- package/components/flow-legend/config.js.map +0 -1
- package/components/flow-legend/index.d.ts +0 -16
- package/components/flow-legend/index.js +0 -75
- package/components/flow-legend/index.js.map +0 -1
- package/components/flow-legend/style.d.ts +0 -8
- package/components/flow-legend/style.js.map +0 -1
- package/components/flow-legend/types.d.ts +0 -9
- package/components/flow-legend/types.js +0 -8
- package/components/flow-legend/types.js.map +0 -1
- package/components/free-brush/config.d.ts +0 -45
- package/components/free-brush/config.js +0 -24
- package/components/free-brush/config.js.map +0 -1
- package/components/free-brush/index.d.ts +0 -20
- package/components/free-brush/index.js +0 -192
- package/components/free-brush/index.js.map +0 -1
- package/components/free-brush/style.d.ts +0 -4
- package/components/free-brush/style.js.map +0 -1
- package/components/free-brush/types.d.ts +0 -7
- package/components/free-brush/types.js +0 -9
- package/components/free-brush/types.js.map +0 -1
- package/components/graph/config.d.ts +0 -238
- package/components/graph/config.js +0 -84
- package/components/graph/config.js.map +0 -1
- package/components/graph/index.d.ts +0 -126
- package/components/graph/index.js +0 -656
- package/components/graph/index.js.map +0 -1
- package/components/graph/modules/layout-helpers.d.ts +0 -21
- package/components/graph/modules/layout-helpers.js +0 -69
- package/components/graph/modules/layout-helpers.js.map +0 -1
- package/components/graph/modules/layout.d.ts +0 -10
- package/components/graph/modules/layout.js +0 -399
- package/components/graph/modules/layout.js.map +0 -1
- package/components/graph/modules/link/helper.d.ts +0 -25
- package/components/graph/modules/link/helper.js +0 -74
- package/components/graph/modules/link/helper.js.map +0 -1
- package/components/graph/modules/link/index.d.ts +0 -11
- package/components/graph/modules/link/index.js +0 -212
- package/components/graph/modules/link/index.js.map +0 -1
- package/components/graph/modules/link/style.d.ts +0 -15
- package/components/graph/modules/link/style.js.map +0 -1
- package/components/graph/modules/node/helper.d.ts +0 -21
- package/components/graph/modules/node/helper.js +0 -126
- package/components/graph/modules/node/helper.js.map +0 -1
- package/components/graph/modules/node/index.d.ts +0 -11
- package/components/graph/modules/node/index.js +0 -252
- package/components/graph/modules/node/index.js.map +0 -1
- package/components/graph/modules/node/style.d.ts +0 -24
- package/components/graph/modules/node/style.js.map +0 -1
- package/components/graph/modules/panel/helper.d.ts +0 -18
- package/components/graph/modules/panel/helper.js +0 -111
- package/components/graph/modules/panel/helper.js.map +0 -1
- package/components/graph/modules/panel/index.d.ts +0 -7
- package/components/graph/modules/panel/index.js +0 -98
- package/components/graph/modules/panel/index.js.map +0 -1
- package/components/graph/modules/panel/style.d.ts +0 -14
- package/components/graph/modules/panel/style.js.map +0 -1
- package/components/graph/modules/shape.d.ts +0 -6
- package/components/graph/modules/shape.js +0 -80
- package/components/graph/modules/shape.js.map +0 -1
- package/components/graph/modules/zoom-levels.d.ts +0 -6
- package/components/graph/modules/zoom-levels.js +0 -10
- package/components/graph/modules/zoom-levels.js.map +0 -1
- package/components/graph/style.d.ts +0 -6
- package/components/graph/style.js +0 -66
- package/components/graph/style.js.map +0 -1
- package/components/graph/types.d.ts +0 -125
- package/components/graph/types.js +0 -30
- package/components/graph/types.js.map +0 -1
- package/components/grouped-bar/config.d.ts +0 -36
- package/components/grouped-bar/config.js +0 -20
- package/components/grouped-bar/config.js.map +0 -1
- package/components/grouped-bar/index.d.ts +0 -32
- package/components/grouped-bar/index.js +0 -249
- package/components/grouped-bar/index.js.map +0 -1
- package/components/grouped-bar/style.d.ts +0 -5
- package/components/grouped-bar/style.js.map +0 -1
- package/components/leaflet-flow-map/config.d.ts +0 -46
- package/components/leaflet-flow-map/config.js +0 -25
- package/components/leaflet-flow-map/config.js.map +0 -1
- package/components/leaflet-flow-map/index.d.ts +0 -52
- package/components/leaflet-flow-map/index.js +0 -220
- package/components/leaflet-flow-map/index.js.map +0 -1
- package/components/leaflet-flow-map/renderer-utils.d.ts +0 -5
- package/components/leaflet-flow-map/renderer-utils.js +0 -15
- package/components/leaflet-flow-map/renderer-utils.js.map +0 -1
- package/components/leaflet-flow-map/renderer.d.ts +0 -26
- package/components/leaflet-flow-map/renderer.js +0 -117
- package/components/leaflet-flow-map/renderer.js.map +0 -1
- package/components/leaflet-flow-map/shaders.d.ts +0 -2
- package/components/leaflet-flow-map/shaders.js.map +0 -1
- package/components/leaflet-flow-map/types.d.ts +0 -23
- package/components/leaflet-map/config.d.ts +0 -193
- package/components/leaflet-map/config.js +0 -71
- package/components/leaflet-map/config.js.map +0 -1
- package/components/leaflet-map/index.d.ts +0 -130
- package/components/leaflet-map/index.js +0 -690
- package/components/leaflet-map/index.js.map +0 -1
- package/components/leaflet-map/leaflet.css.js +0 -5
- package/components/leaflet-map/leaflet.css.js.map +0 -1
- package/components/leaflet-map/modules/clusterBackground.d.ts +0 -5
- package/components/leaflet-map/modules/clusterBackground.js +0 -27
- package/components/leaflet-map/modules/clusterBackground.js.map +0 -1
- package/components/leaflet-map/modules/donut.d.ts +0 -3
- package/components/leaflet-map/modules/donut.js +0 -25
- package/components/leaflet-map/modules/donut.js.map +0 -1
- package/components/leaflet-map/modules/map.d.ts +0 -14
- package/components/leaflet-map/modules/map.js +0 -154
- package/components/leaflet-map/modules/map.js.map +0 -1
- package/components/leaflet-map/modules/node.d.ts +0 -9
- package/components/leaflet-map/modules/node.js +0 -162
- package/components/leaflet-map/modules/node.js.map +0 -1
- package/components/leaflet-map/modules/selectionRing.d.ts +0 -7
- package/components/leaflet-map/modules/selectionRing.js +0 -41
- package/components/leaflet-map/modules/selectionRing.js.map +0 -1
- package/components/leaflet-map/modules/utils.d.ts +0 -50
- package/components/leaflet-map/modules/utils.js +0 -210
- package/components/leaflet-map/modules/utils.js.map +0 -1
- package/components/leaflet-map/renderer/leaflet-maplibre-gl.js.map +0 -1
- package/components/leaflet-map/renderer/map-style.d.ts +0 -4
- package/components/leaflet-map/renderer/map-style.js +0 -15
- package/components/leaflet-map/renderer/map-style.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js +0 -40
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js +0 -40
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js +0 -4981
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl-layer.d.ts +0 -8
- package/components/leaflet-map/renderer/mapboxgl-layer.js +0 -27
- package/components/leaflet-map/renderer/mapboxgl-layer.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +0 -4
- package/components/leaflet-map/renderer/mapboxgl-utils.js +0 -39
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +0 -1
- package/components/leaflet-map/renderer/maplibre-gl.css.js.map +0 -1
- package/components/leaflet-map/style.d.ts +0 -52
- package/components/leaflet-map/style.js +0 -183
- package/components/leaflet-map/style.js.map +0 -1
- package/components/leaflet-map/types.d.ts +0 -75
- package/components/leaflet-map/types.js +0 -15
- package/components/leaflet-map/types.js.map +0 -1
- package/components/line/config.d.ts +0 -30
- package/components/line/config.js +0 -17
- package/components/line/config.js.map +0 -1
- package/components/line/index.d.ts +0 -27
- package/components/line/index.js +0 -152
- package/components/line/index.js.map +0 -1
- package/components/line/style.d.ts +0 -6
- package/components/line/style.js.map +0 -1
- package/components/line/types.d.ts +0 -12
- package/components/nested-donut/config.d.ts +0 -59
- package/components/nested-donut/config.js +0 -19
- package/components/nested-donut/config.js.map +0 -1
- package/components/nested-donut/index.d.ts +0 -38
- package/components/nested-donut/index.js +0 -133
- package/components/nested-donut/index.js.map +0 -1
- package/components/nested-donut/modules/arc.d.ts +0 -17
- package/components/nested-donut/modules/arc.js +0 -50
- package/components/nested-donut/modules/arc.js.map +0 -1
- package/components/nested-donut/modules/label.d.ts +0 -7
- package/components/nested-donut/modules/label.js +0 -34
- package/components/nested-donut/modules/label.js.map +0 -1
- package/components/nested-donut/style.d.ts +0 -26
- package/components/nested-donut/style.js +0 -70
- package/components/nested-donut/style.js.map +0 -1
- package/components/nested-donut/types.d.ts +0 -24
- package/components/nested-donut/types.js +0 -11
- package/components/nested-donut/types.js.map +0 -1
- package/components/sankey/config.d.ts +0 -162
- package/components/sankey/config.js +0 -65
- package/components/sankey/config.js.map +0 -1
- package/components/sankey/index.d.ts +0 -59
- package/components/sankey/index.js +0 -306
- package/components/sankey/index.js.map +0 -1
- package/components/sankey/modules/label.d.ts +0 -23
- package/components/sankey/modules/label.js +0 -168
- package/components/sankey/modules/label.js.map +0 -1
- package/components/sankey/modules/link.d.ts +0 -14
- package/components/sankey/modules/link.js +0 -108
- package/components/sankey/modules/link.js.map +0 -1
- package/components/sankey/modules/node.d.ts +0 -10
- package/components/sankey/modules/node.js +0 -156
- package/components/sankey/modules/node.js.map +0 -1
- package/components/sankey/style.d.ts +0 -20
- package/components/sankey/style.js.map +0 -1
- package/components/sankey/types.d.ts +0 -84
- package/components/sankey/types.js +0 -34
- package/components/sankey/types.js.map +0 -1
- package/components/scatter/config.d.ts +0 -44
- package/components/scatter/config.js +0 -23
- package/components/scatter/config.js.map +0 -1
- package/components/scatter/index.d.ts +0 -28
- package/components/scatter/index.js +0 -167
- package/components/scatter/index.js.map +0 -1
- package/components/scatter/modules/point.d.ts +0 -7
- package/components/scatter/modules/point.js +0 -86
- package/components/scatter/modules/point.js.map +0 -1
- package/components/scatter/modules/utils.d.ts +0 -11
- package/components/scatter/modules/utils.js +0 -112
- package/components/scatter/modules/utils.js.map +0 -1
- package/components/scatter/style.d.ts +0 -5
- package/components/scatter/style.js.map +0 -1
- package/components/scatter/types.d.ts +0 -19
- package/components/stacked-bar/config.d.ts +0 -38
- package/components/stacked-bar/config.js +0 -20
- package/components/stacked-bar/config.js.map +0 -1
- package/components/stacked-bar/index.d.ts +0 -28
- package/components/stacked-bar/index.js +0 -208
- package/components/stacked-bar/index.js.map +0 -1
- package/components/stacked-bar/style.d.ts +0 -5
- package/components/stacked-bar/style.js.map +0 -1
- package/components/stacked-bar/types.d.ts +0 -5
- package/components/timeline/config.d.ts +0 -43
- package/components/timeline/config.js +0 -24
- package/components/timeline/config.js.map +0 -1
- package/components/timeline/index.d.ts +0 -41
- package/components/timeline/index.js +0 -244
- package/components/timeline/index.js.map +0 -1
- package/components/timeline/style.d.ts +0 -13
- package/components/timeline/style.js.map +0 -1
- package/components/tooltip/config.d.ts +0 -68
- package/components/tooltip/config.js +0 -20
- package/components/tooltip/config.js.map +0 -1
- package/components/tooltip/index.d.ts +0 -36
- package/components/tooltip/index.js +0 -184
- package/components/tooltip/index.js.map +0 -1
- package/components/tooltip/style.js.map +0 -1
- package/components/topojson-map/config.d.ts +0 -99
- package/components/topojson-map/config.js +0 -42
- package/components/topojson-map/config.js.map +0 -1
- package/components/topojson-map/index.d.ts +0 -52
- package/components/topojson-map/index.js +0 -355
- package/components/topojson-map/index.js.map +0 -1
- package/components/topojson-map/style.d.ts +0 -11
- package/components/topojson-map/style.js.map +0 -1
- package/components/topojson-map/types.d.ts +0 -78
- package/components/topojson-map/types.js +0 -80
- package/components/topojson-map/types.js.map +0 -1
- package/components/topojson-map/utils.d.ts +0 -3
- package/components/topojson-map/utils.js +0 -30
- package/components/topojson-map/utils.js.map +0 -1
- package/components/vis-controls/config.d.ts +0 -12
- package/components/vis-controls/config.js +0 -13
- package/components/vis-controls/config.js.map +0 -1
- package/components/vis-controls/index.d.ts +0 -14
- package/components/vis-controls/index.js +0 -52
- package/components/vis-controls/index.js.map +0 -1
- package/components/vis-controls/style.d.ts +0 -11
- package/components/vis-controls/style.js.map +0 -1
- package/components/vis-controls/types.d.ts +0 -13
- package/components/vis-controls/types.js +0 -8
- package/components/vis-controls/types.js.map +0 -1
- package/components/xy-labels/config.d.ts +0 -48
- package/components/xy-labels/config.js +0 -25
- package/components/xy-labels/config.js.map +0 -1
- package/components/xy-labels/index.d.ts +0 -15
- package/components/xy-labels/index.js +0 -87
- package/components/xy-labels/index.js.map +0 -1
- package/components/xy-labels/modules/label.d.ts +0 -9
- package/components/xy-labels/modules/label.js +0 -107
- package/components/xy-labels/modules/label.js.map +0 -1
- package/components/xy-labels/style.d.ts +0 -5
- package/components/xy-labels/style.js.map +0 -1
- package/components/xy-labels/types.d.ts +0 -23
- package/components/xy-labels/types.js +0 -9
- package/components/xy-labels/types.js.map +0 -1
- package/components.d.ts +0 -51
- package/components.js +0 -29
- package/components.js.map +0 -1
- package/containers/single-container/config.d.ts +0 -12
- package/containers/single-container/config.js +0 -12
- package/containers/single-container/config.js.map +0 -1
- package/containers/single-container/index.d.ts +0 -19
- package/containers/single-container/index.js +0 -128
- package/containers/single-container/index.js.map +0 -1
- package/containers/xy-container/config.d.ts +0 -99
- package/containers/xy-container/config.js +0 -30
- package/containers/xy-container/config.js.map +0 -1
- package/containers/xy-container/index.d.ts +0 -34
- package/containers/xy-container/index.js +0 -330
- package/containers/xy-container/index.js.map +0 -1
- package/containers.d.ts +0 -6
- package/containers.js +0 -4
- package/containers.js.map +0 -1
- package/core/component/config.d.ts +0 -58
- package/core/component/config.js +0 -14
- package/core/component/config.js.map +0 -1
- package/core/component/index.d.ts +0 -43
- package/core/component/index.js +0 -118
- package/core/component/index.js.map +0 -1
- package/core/component/types.d.ts +0 -2
- package/core/component/types.js +0 -2
- package/core/component/types.js.map +0 -1
- package/core/config/index.d.ts +0 -3
- package/core/config/index.js +0 -16
- package/core/config/index.js.map +0 -1
- package/core/container/config.d.ts +0 -48
- package/core/container/config.js +0 -29
- package/core/container/config.js.map +0 -1
- package/core/container/index.d.ts +0 -26
- package/core/container/index.js +0 -105
- package/core/container/index.js.map +0 -1
- package/core/xy-component/config.d.ts +0 -38
- package/core/xy-component/config.js +0 -20
- package/core/xy-component/config.js.map +0 -1
- package/core/xy-component/index.d.ts +0 -27
- package/core/xy-component/index.js +0 -74
- package/core/xy-component/index.js.map +0 -1
- package/data-models/core.d.ts +0 -6
- package/data-models/core.js +0 -14
- package/data-models/core.js.map +0 -1
- package/data-models/graph.d.ts +0 -24
- package/data-models/graph.js +0 -107
- package/data-models/graph.js.map +0 -1
- package/data-models/map-graph.d.ts +0 -21
- package/data-models/map-graph.js +0 -62
- package/data-models/map-graph.js.map +0 -1
- package/data-models/map.d.ts +0 -5
- package/data-models/map.js +0 -12
- package/data-models/map.js.map +0 -1
- package/data-models/series.d.ts +0 -6
- package/data-models/series.js +0 -19
- package/data-models/series.js.map +0 -1
- package/index.d.ts +0 -7
- package/index.js +0 -55
- package/index.js.map +0 -1
- package/maps/china-provinces.json.js +0 -140373
- package/maps/fr-regions.json.js +0 -14162
- package/maps/germany-regions.json.js +0 -35760
- package/maps/ind-regions.json.js +0 -290584
- package/maps/uk-regions.json.js +0 -96233
- package/maps/us-counties.json.js +0 -206318
- package/maps/us-states.json.js +0 -16345
- package/maps/world-110m-alpha.json.js +0 -251366
- package/maps/world-simple.json.js +0 -89428
- package/maps/world-simplest.json.js +0 -28175
- package/maps.d.ts +0 -60
- package/maps.js +0 -23
- package/styles/colors.d.ts +0 -7
- package/styles/colors.js +0 -24
- package/styles/colors.js.map +0 -1
- package/styles/index.d.ts +0 -7
- package/styles/index.js +0 -38
- package/styles/index.js.map +0 -1
- package/styles/sizes.d.ts +0 -2
- package/styles/sizes.js.map +0 -1
- package/types/accessor.d.ts +0 -5
- package/types/accessor.js +0 -2
- package/types/accessor.js.map +0 -1
- package/types/component.d.ts +0 -13
- package/types/component.js +0 -14
- package/types/component.js.map +0 -1
- package/types/curve.d.ts +0 -40
- package/types/curve.js +0 -46
- package/types/curve.js.map +0 -1
- package/types/data.d.ts +0 -7
- package/types/data.js +0 -2
- package/types/data.js.map +0 -1
- package/types/direction.d.ts +0 -6
- package/types/direction.js +0 -10
- package/types/direction.js.map +0 -1
- package/types/graph.d.ts +0 -35
- package/types/graph.js +0 -2
- package/types/graph.js.map +0 -1
- package/types/map.d.ts +0 -4
- package/types/map.js +0 -2
- package/types/map.js.map +0 -1
- package/types/misc.d.ts +0 -8
- package/types/position.d.ts +0 -20
- package/types/position.js +0 -27
- package/types/position.js.map +0 -1
- package/types/scale.d.ts +0 -23
- package/types/scale.js +0 -27
- package/types/scale.js.map +0 -1
- package/types/shape.d.ts +0 -7
- package/types/shape.js +0 -11
- package/types/shape.js.map +0 -1
- package/types/spacing.d.ts +0 -6
- package/types/spacing.js +0 -2
- package/types/spacing.js.map +0 -1
- package/types/svg.d.ts +0 -18
- package/types/svg.js +0 -22
- package/types/svg.js.map +0 -1
- package/types/symbol.d.ts +0 -18
- package/types/symbol.js +0 -24
- package/types/symbol.js.map +0 -1
- package/types/text.d.ts +0 -47
- package/types/text.js +0 -26
- package/types/text.js.map +0 -1
- package/types.d.ts +0 -27
- package/types.js +0 -30
- package/types.js.map +0 -1
- package/utils/color.d.ts +0 -10
- package/utils/color.js +0 -32
- package/utils/color.js.map +0 -1
- package/utils/d3.d.ts +0 -3
- package/utils/d3.js +0 -16
- package/utils/d3.js.map +0 -1
- package/utils/data.d.ts +0 -45
- package/utils/data.js +0 -274
- package/utils/data.js.map +0 -1
- package/utils/html.d.ts +0 -1
- package/utils/html.js +0 -16
- package/utils/html.js.map +0 -1
- package/utils/map.d.ts +0 -2
- package/utils/map.js +0 -20
- package/utils/map.js.map +0 -1
- package/utils/misc.d.ts +0 -9
- package/utils/misc.js +0 -47
- package/utils/misc.js.map +0 -1
- package/utils/path.d.ts +0 -23
- package/utils/path.js +0 -144
- package/utils/path.js.map +0 -1
- package/utils/scale.d.ts +0 -1
- package/utils/style.d.ts +0 -6
- package/utils/style.js +0 -24
- package/utils/style.js.map +0 -1
- package/utils/svg.d.ts +0 -3
- package/utils/text.d.ts +0 -139
- package/utils/text.js +0 -443
- package/utils/text.js.map +0 -1
- package/utils/type.d.ts +0 -5
|
@@ -1,690 +0,0 @@
|
|
|
1
|
-
import { select } from 'd3-selection';
|
|
2
|
-
import { packSiblings } from 'd3-hierarchy';
|
|
3
|
-
import { ResizeObserver } from '@juggle/resize-observer';
|
|
4
|
-
import { ComponentCore } from '../../core/component/index.js';
|
|
5
|
-
import { MapDataModel } from '../../data-models/map.js';
|
|
6
|
-
import { ComponentType } from '../../types/component.js';
|
|
7
|
-
import { isString, getNumber, isNil, getString, clamp } from '../../utils/data.js';
|
|
8
|
-
import { constraintMapViewThrottled } from './renderer/mapboxgl-utils.js';
|
|
9
|
-
import { calculateClusterIndex, projectPoint, findPointAndClusterByPointId, getNodeRelativePosition, bBoxMerge, shouldClusterExpand, getNextZoomLevelOnClusterClick, getPointRadius, getClusterRadius, getClustersAndPoints, geoJsonPointToScreenPoint } from './modules/utils.js';
|
|
10
|
-
import { LeafletMapRenderer } from './types.js';
|
|
11
|
-
import { LeafletMapConfig } from './config.js';
|
|
12
|
-
import * as style from './style.js';
|
|
13
|
-
import { root, map, svgOverlay, backgroundRect, points, clusterBackground, pointSelectionRing, point, variables } from './style.js';
|
|
14
|
-
import { setupMap, initialMapCenter, initialMapZoom, updateTopoJson } from './modules/map.js';
|
|
15
|
-
import { removeNodes, createNodes, updateNodes, collideLabels } from './modules/node.js';
|
|
16
|
-
import { createNodeSelectionRing, updateNodeSelectionRing } from './modules/selectionRing.js';
|
|
17
|
-
import { createBackgroundNode, updateBackgroundNode } from './modules/clusterBackground.js';
|
|
18
|
-
|
|
19
|
-
class LeafletMap extends ComponentCore {
|
|
20
|
-
constructor(container, config, data) {
|
|
21
|
-
super(ComponentType.HTML);
|
|
22
|
-
this.type = ComponentType.HTML;
|
|
23
|
-
this.config = new LeafletMapConfig();
|
|
24
|
-
this.datamodel = new MapDataModel();
|
|
25
|
-
this._expandedCluster = null;
|
|
26
|
-
this._cancelBackgroundClick = false;
|
|
27
|
-
this._hasBeenMoved = false;
|
|
28
|
-
this._hasBeenZoomed = false;
|
|
29
|
-
this._isMoving = false;
|
|
30
|
-
this._isZooming = false;
|
|
31
|
-
this._eventInitiatedByComponent = false;
|
|
32
|
-
this._triggerBackgroundClick = false;
|
|
33
|
-
this._externallySelectedPoint = null;
|
|
34
|
-
this._zoomingToExternallySelectedPoint = false;
|
|
35
|
-
this._forceExpandCluster = false;
|
|
36
|
-
this._clusterBackgroundRadius = 0;
|
|
37
|
-
this._selectedPoint = null;
|
|
38
|
-
this._currentZoomLevel = null;
|
|
39
|
-
this._firstRender = true;
|
|
40
|
-
this._isDarkThemeActive = false;
|
|
41
|
-
this._renderDataAnimationFrameId = null;
|
|
42
|
-
this._flyToBoundsAnimationFrameId = null;
|
|
43
|
-
this.events = {
|
|
44
|
-
[LeafletMap.selectors.point]: {
|
|
45
|
-
mouseup: this._onPointMouseUp.bind(this),
|
|
46
|
-
mousedown: this._onPointMouseDown.bind(this),
|
|
47
|
-
click: this._onPointClick.bind(this),
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
this._container = container;
|
|
51
|
-
this._containerSelection = select(this._container);
|
|
52
|
-
this._container.appendChild(this.element);
|
|
53
|
-
this.g.attr('class', root);
|
|
54
|
-
if (config)
|
|
55
|
-
this.setConfig(config);
|
|
56
|
-
if (!this._container.clientWidth) {
|
|
57
|
-
console.warn('Unovis | Leaflet Map: The width of the container is not set. Setting to 100%.');
|
|
58
|
-
this._containerSelection.style('width', '100%');
|
|
59
|
-
}
|
|
60
|
-
if (!this._container.clientHeight) {
|
|
61
|
-
console.warn(`Unovis | Leaflet Map: The height of the container is not set. Setting to ${LeafletMap.DEFAULT_CONTAINER_HEIGHT}px.`);
|
|
62
|
-
this._containerSelection.style('height', `${LeafletMap.DEFAULT_CONTAINER_HEIGHT}px`);
|
|
63
|
-
}
|
|
64
|
-
// Initialize map asynchronously
|
|
65
|
-
this._leafletInitializationPromise = new Promise((resolve) => {
|
|
66
|
-
setupMap(this.element, this.config).then(map$1 => {
|
|
67
|
-
var _a, _b;
|
|
68
|
-
// Apply the `s.map` class to `tilePane` to allow tooltip interactions
|
|
69
|
-
select(map$1.leaflet.getPanes().tilePane).classed(map, true);
|
|
70
|
-
if (config)
|
|
71
|
-
this.setConfig(config);
|
|
72
|
-
this._map = map$1;
|
|
73
|
-
this._map.leaflet.on('drag', this._onMapDragLeaflet.bind(this));
|
|
74
|
-
this._map.leaflet.on('move', this._onMapMove.bind(this));
|
|
75
|
-
this._map.leaflet.on('movestart', this._onMapMoveStart.bind(this));
|
|
76
|
-
this._map.leaflet.on('moveend', this._onMapMoveEnd.bind(this));
|
|
77
|
-
this._map.leaflet.on('zoom', this._onMapZoom.bind(this));
|
|
78
|
-
this._map.leaflet.on('zoomstart', this._onMapZoomStart.bind(this));
|
|
79
|
-
this._map.leaflet.on('zoomend', this._onMapZoomEnd.bind(this));
|
|
80
|
-
// We need to handle background click in a special way to deal
|
|
81
|
-
// with d3 svg overlay that might have smaller size than the map itself
|
|
82
|
-
// (see this._onNodeMouseDown() and this this._onNodeMouseDown())
|
|
83
|
-
this._map.leaflet.on('mousedown', () => {
|
|
84
|
-
if (!this._cancelBackgroundClick)
|
|
85
|
-
this._triggerBackgroundClick = true;
|
|
86
|
-
});
|
|
87
|
-
this._map.leaflet.on('mouseup', (e) => {
|
|
88
|
-
if (this._triggerBackgroundClick) {
|
|
89
|
-
this._triggerBackgroundClick = false;
|
|
90
|
-
const originalEvent = e.originalEvent;
|
|
91
|
-
this._onBackgroundClick(originalEvent.target, originalEvent);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
this._map.svgOverlay
|
|
95
|
-
.attr('class', svgOverlay)
|
|
96
|
-
.insert('rect', ':first-child')
|
|
97
|
-
.attr('class', backgroundRect)
|
|
98
|
-
.attr('width', '100%')
|
|
99
|
-
.attr('height', '100%');
|
|
100
|
-
this._pointGroup = this._map.svgGroup.append('g').attr('class', points);
|
|
101
|
-
this._clusterBackground = this._pointGroup.append('g')
|
|
102
|
-
.attr('class', clusterBackground)
|
|
103
|
-
.call(createBackgroundNode);
|
|
104
|
-
this._pointSelectionRing = this._pointGroup.append('g')
|
|
105
|
-
.attr('class', pointSelectionRing)
|
|
106
|
-
.call(createNodeSelectionRing);
|
|
107
|
-
this._map.leaflet.setView(initialMapCenter, initialMapZoom);
|
|
108
|
-
if (document.body.classList.contains('theme-dark') && config.styleDarkTheme) {
|
|
109
|
-
this._isDarkThemeActive = true;
|
|
110
|
-
this.setTheme(config.styleDarkTheme);
|
|
111
|
-
}
|
|
112
|
-
(_b = (_a = this.config).onMapInitialized) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
113
|
-
resolve(this._map.leaflet);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
// Set data and render the map when it's ready
|
|
117
|
-
this.setData(data !== null && data !== void 0 ? data : []);
|
|
118
|
-
// When the container size changes we have to initiate map resize in order to update its dimensions
|
|
119
|
-
this.resizeObserver = new ResizeObserver(() => {
|
|
120
|
-
var _a, _b, _c;
|
|
121
|
-
(_b = (_a = this._map) === null || _a === void 0 ? void 0 : _a.leaflet) === null || _b === void 0 ? void 0 : _b.invalidateSize();
|
|
122
|
-
(_c = this.config.tooltip) === null || _c === void 0 ? void 0 : _c.hide();
|
|
123
|
-
});
|
|
124
|
-
this.resizeObserver.observe(container);
|
|
125
|
-
// If dark theme is enabled, update map's style when document body's class list changes
|
|
126
|
-
if (this.config.styleDarkTheme) {
|
|
127
|
-
this.themeObserver = new MutationObserver((mutations) => {
|
|
128
|
-
mutations.forEach(change => {
|
|
129
|
-
if (change.attributeName === 'class') {
|
|
130
|
-
const isDarkTheme = change.target.classList.contains('theme-dark');
|
|
131
|
-
if (this._isDarkThemeActive !== isDarkTheme) {
|
|
132
|
-
this.setTheme(isDarkTheme ? this.config.styleDarkTheme : this.config.style);
|
|
133
|
-
this._isDarkThemeActive = isDarkTheme;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
this.themeObserver.observe(document.body, { attributes: true });
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
setConfig(config) {
|
|
142
|
-
this.config = new LeafletMapConfig().init(config);
|
|
143
|
-
if (config.width)
|
|
144
|
-
this._containerSelection.style('width', isString(config.width) ? config.width : `${config.width}px`);
|
|
145
|
-
if (config.height)
|
|
146
|
-
this._containerSelection.style('height', isString(config.height) ? config.height : `${config.height}px`);
|
|
147
|
-
if (this._map && config.renderer === LeafletMapRenderer.MapLibre) {
|
|
148
|
-
const layer = this._map.layer; // Using any because the typings are not full
|
|
149
|
-
const maplibreMap = layer.getMaplibreMap();
|
|
150
|
-
if (maplibreMap.isStyleLoaded())
|
|
151
|
-
updateTopoJson(maplibreMap, this.config);
|
|
152
|
-
}
|
|
153
|
-
if (this.config.tooltip) {
|
|
154
|
-
this.config.tooltip.setContainer(this._container);
|
|
155
|
-
this.config.tooltip.setComponents([this]);
|
|
156
|
-
this.config.tooltip.update();
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
setData(data) {
|
|
160
|
-
const { config, datamodel } = this;
|
|
161
|
-
const dataValid = data.filter(d => {
|
|
162
|
-
const lat = getNumber(d, config.pointLatitude);
|
|
163
|
-
const lon = getNumber(d, config.pointLongitude);
|
|
164
|
-
const valid = isFinite(lat) && isFinite(lon);
|
|
165
|
-
if (!valid)
|
|
166
|
-
console.warn('Unovis | Leaflet Map: Invalid point coordinates', d);
|
|
167
|
-
return valid;
|
|
168
|
-
});
|
|
169
|
-
datamodel.data = dataValid;
|
|
170
|
-
// We use Supercluster for real-time node clustering
|
|
171
|
-
this._clusterIndex = calculateClusterIndex(dataValid, this.config);
|
|
172
|
-
// If there was an expanded cluster, try to find its successor and expand it too
|
|
173
|
-
if (this._expandedCluster && this._map.leaflet) {
|
|
174
|
-
// Reset expanded cluster before calling `_getPointData()` to get data with all clusters collapsed
|
|
175
|
-
const expandedCluster = this._expandedCluster;
|
|
176
|
-
this._resetExpandedCluster();
|
|
177
|
-
const pointData = this._getPointData();
|
|
178
|
-
const expandedClusterCenterPx = projectPoint(expandedCluster.cluster, this._map.leaflet);
|
|
179
|
-
const expandedClusterRadiusPx = expandedCluster.cluster.radius;
|
|
180
|
-
const cluster = pointData.find((c) => {
|
|
181
|
-
if (!c.isCluster)
|
|
182
|
-
return false;
|
|
183
|
-
const pos = projectPoint(c, this._map.leaflet);
|
|
184
|
-
const r = c.radius;
|
|
185
|
-
const distance = Math.sqrt(Math.pow((expandedClusterCenterPx.x - pos.x), 2) + Math.pow((expandedClusterCenterPx.y - pos.y), 2));
|
|
186
|
-
return distance < (expandedClusterRadiusPx + r);
|
|
187
|
-
});
|
|
188
|
-
if (cluster)
|
|
189
|
-
this._expandCluster(cluster, true);
|
|
190
|
-
}
|
|
191
|
-
// Render
|
|
192
|
-
this._leafletInitializationPromise.then(() => {
|
|
193
|
-
this.render();
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
setTheme(theme) {
|
|
197
|
-
var _a;
|
|
198
|
-
const layer = this._map.layer; // Using any because the typings are not full
|
|
199
|
-
if (this.config.renderer === LeafletMapRenderer.MapLibre) {
|
|
200
|
-
const maplibreMap = layer.getMaplibreMap();
|
|
201
|
-
(_a = maplibreMap.setStyle) === null || _a === void 0 ? void 0 : _a.call(maplibreMap, theme);
|
|
202
|
-
updateTopoJson(maplibreMap, this.config);
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
if (typeof theme !== 'string') {
|
|
206
|
-
console.warn('Unovis | Leaflet Map: Invalid style. Provide a URL string for raster rendering mode.');
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
layer.setUrl(theme);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
// We redefine the ComponentCore render function to bind event to newly created elements in this._renderData(),
|
|
213
|
-
// which is being called after almost every map interaction
|
|
214
|
-
render() {
|
|
215
|
-
const { config } = this;
|
|
216
|
-
if (!this._map)
|
|
217
|
-
return;
|
|
218
|
-
this._renderData();
|
|
219
|
-
if (this._firstRender) {
|
|
220
|
-
if (config.initialBounds)
|
|
221
|
-
this.fitToBounds(config.initialBounds);
|
|
222
|
-
else if (config.fitViewOnInit)
|
|
223
|
-
this.fitToPoints(0, config.fitViewPadding);
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
if (config.fitViewOnUpdate)
|
|
227
|
-
this.fitToPoints(0, config.fitViewPadding);
|
|
228
|
-
else if (config.fitBoundsOnUpdate)
|
|
229
|
-
this.fitToBounds(config.fitBoundsOnUpdate);
|
|
230
|
-
}
|
|
231
|
-
this._firstRender = false;
|
|
232
|
-
}
|
|
233
|
-
getLeafletInstancePromise() {
|
|
234
|
-
return this._leafletInitializationPromise;
|
|
235
|
-
}
|
|
236
|
-
fitToPoints(duration = this.config.flyToDuration, padding = this.config.fitViewPadding) {
|
|
237
|
-
const { config, datamodel, datamodel: { data } } = this;
|
|
238
|
-
if (!this._map || !this._map.leaflet)
|
|
239
|
-
return;
|
|
240
|
-
if (!(data === null || data === void 0 ? void 0 : data.length))
|
|
241
|
-
return;
|
|
242
|
-
const bounds = datamodel.getDataLatLngBounds(config.pointLatitude, config.pointLongitude);
|
|
243
|
-
this._flyToBoundsAnimationFrameId = requestAnimationFrame(() => this._flyToBounds(bounds, duration, padding));
|
|
244
|
-
}
|
|
245
|
-
fitToBounds(bounds, duration = this.config.flyToDuration, padding = this.config.fitViewPadding) {
|
|
246
|
-
const { northEast, southWest } = bounds;
|
|
247
|
-
if (isNil(northEast) || isNil(southWest))
|
|
248
|
-
return;
|
|
249
|
-
if (isNil(northEast.lat) || isNil(northEast.lng))
|
|
250
|
-
return;
|
|
251
|
-
if (isNil(southWest.lat) || isNil(southWest.lng))
|
|
252
|
-
return;
|
|
253
|
-
if (!this._map || !this._map.leaflet)
|
|
254
|
-
return;
|
|
255
|
-
this._flyToBoundsAnimationFrameId = requestAnimationFrame(() => this._flyToBounds([
|
|
256
|
-
[northEast.lat, southWest.lng],
|
|
257
|
-
[southWest.lat, northEast.lng],
|
|
258
|
-
], duration, padding));
|
|
259
|
-
}
|
|
260
|
-
/* Select a point by id and optionally center the map view.
|
|
261
|
-
* This method was designed to be used mainly with the `[LeafletMap.selectors.point]` click events
|
|
262
|
-
* (when the user actually clicks on a point) and the specified point is inside one of the collapsed
|
|
263
|
-
* clusters it won't be selected. You can use the `zoomToPointById` method to achieve that.
|
|
264
|
-
*/
|
|
265
|
-
selectPointById(id, centerView = false) {
|
|
266
|
-
var _a, _b, _c;
|
|
267
|
-
const { config } = this;
|
|
268
|
-
const pointData = this._getPointData();
|
|
269
|
-
const foundPoint = pointData.find(d => d.properties.id === id);
|
|
270
|
-
if (!foundPoint) {
|
|
271
|
-
console.warn(`Unovis | Leaflet Map: Node with id ${id} can not be found`);
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
if ((_a = foundPoint.properties) === null || _a === void 0 ? void 0 : _a.cluster) {
|
|
275
|
-
console.warn('Unovis | Leaflet Map: Cluster can\'t be selected');
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
this._selectedPoint = foundPoint;
|
|
279
|
-
const isPointInsideExpandedCluster = (_c = (_b = this._expandedCluster) === null || _b === void 0 ? void 0 : _b.points) === null || _c === void 0 ? void 0 : _c.find(d => getString(d.properties, config.pointId) === id);
|
|
280
|
-
if (!isPointInsideExpandedCluster)
|
|
281
|
-
this._resetExpandedCluster();
|
|
282
|
-
if (centerView) {
|
|
283
|
-
const coordinates = {
|
|
284
|
-
lng: getNumber(foundPoint.properties, config.pointLongitude),
|
|
285
|
-
lat: getNumber(foundPoint.properties, config.pointLatitude),
|
|
286
|
-
};
|
|
287
|
-
const zoomLevel = this._map.leaflet.getZoom();
|
|
288
|
-
this._eventInitiatedByComponent = true;
|
|
289
|
-
this._map.leaflet.flyTo(coordinates, zoomLevel, { duration: 0 });
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
this._renderData();
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
/* Get the id of the selected point */
|
|
296
|
-
getSelectedPointId() {
|
|
297
|
-
var _a;
|
|
298
|
-
return (_a = this._selectedPoint) === null || _a === void 0 ? void 0 : _a.id;
|
|
299
|
-
}
|
|
300
|
-
/* Unselect point if it was selected before */
|
|
301
|
-
unselectPoint() {
|
|
302
|
-
this._selectedPoint = null;
|
|
303
|
-
this._externallySelectedPoint = null;
|
|
304
|
-
this.render();
|
|
305
|
-
}
|
|
306
|
-
/* Zoom to a point by id and optionally select it.
|
|
307
|
-
* If the point is inside a cluster, it'll be automatically expanded to show the enclosed point.
|
|
308
|
-
* You can also force set the zoom level by providing the `customZoomLevel` argument.
|
|
309
|
-
*/
|
|
310
|
-
zoomToPointById(id, selectPoint = false, customZoomLevel) {
|
|
311
|
-
var _a, _b, _c;
|
|
312
|
-
const { config, datamodel } = this;
|
|
313
|
-
if (!datamodel.data.length) {
|
|
314
|
-
console.warn('Unovis | Leaflet Map: There are no points on the map');
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
const dataBoundsAll = datamodel.getDataLatLngBounds(config.pointLatitude, config.pointLongitude);
|
|
318
|
-
const bounds = [dataBoundsAll[0][1], dataBoundsAll[1][0], dataBoundsAll[1][1], dataBoundsAll[0][0]];
|
|
319
|
-
const pointDataAll = this._getPointData(bounds);
|
|
320
|
-
let foundPoint = pointDataAll
|
|
321
|
-
.find((d) => getString(d.properties, config.pointId) === id);
|
|
322
|
-
// If point was found and it's a cluster -> do nothing
|
|
323
|
-
if ((_a = foundPoint === null || foundPoint === void 0 ? void 0 : foundPoint.properties) === null || _a === void 0 ? void 0 : _a.cluster) {
|
|
324
|
-
console.warn('Unovis | Leaflet Map: Cluster can\'t be zoomed in');
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
// If point was not found -> search for it in all collapsed clusters
|
|
328
|
-
if (!foundPoint) {
|
|
329
|
-
const { point } = findPointAndClusterByPointId(pointDataAll, id, config.pointId);
|
|
330
|
-
foundPoint = point;
|
|
331
|
-
}
|
|
332
|
-
if (foundPoint) {
|
|
333
|
-
// If point was found and it's inside an expanded cluster -> simply select it
|
|
334
|
-
const isPointInsideExpandedCluster = (_c = (_b = this._expandedCluster) === null || _b === void 0 ? void 0 : _b.points) === null || _c === void 0 ? void 0 : _c.find(d => getString(d.properties, config.pointId) === id);
|
|
335
|
-
if (isPointInsideExpandedCluster && selectPoint) {
|
|
336
|
-
this._selectedPoint = foundPoint;
|
|
337
|
-
this._renderData();
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
// Else - trigger zoom
|
|
341
|
-
this._externallySelectedPoint = foundPoint;
|
|
342
|
-
this._zoomingToExternallySelectedPoint = true;
|
|
343
|
-
this._forceExpandCluster = !isNil(customZoomLevel);
|
|
344
|
-
if (selectPoint)
|
|
345
|
-
this._selectedPoint = foundPoint;
|
|
346
|
-
const zoomLevel = isNil(customZoomLevel) ? this._map.leaflet.getZoom() : customZoomLevel;
|
|
347
|
-
const pointDatum = foundPoint.properties;
|
|
348
|
-
const coordinates = {
|
|
349
|
-
lng: getNumber(pointDatum, config.pointLongitude),
|
|
350
|
-
lat: getNumber(pointDatum, config.pointLatitude),
|
|
351
|
-
};
|
|
352
|
-
this._eventInitiatedByComponent = true;
|
|
353
|
-
this._map.leaflet.flyTo(coordinates, zoomLevel, { duration: 0 });
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
console.warn(`Unovis | Leaflet Map: Node with id ${id} can not be found`);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
getNodeRelativePosition(node) {
|
|
360
|
-
return getNodeRelativePosition(node, this._map.leaflet);
|
|
361
|
-
}
|
|
362
|
-
hasBeenZoomed() {
|
|
363
|
-
return this._hasBeenZoomed;
|
|
364
|
-
}
|
|
365
|
-
hasBeenMoved() {
|
|
366
|
-
return this._hasBeenMoved;
|
|
367
|
-
}
|
|
368
|
-
isZooming() {
|
|
369
|
-
return this._isZooming;
|
|
370
|
-
}
|
|
371
|
-
isMoving() {
|
|
372
|
-
return this._isMoving;
|
|
373
|
-
}
|
|
374
|
-
_flyToBounds(bounds, durationMs, paddingPx) {
|
|
375
|
-
this._eventInitiatedByComponent = true;
|
|
376
|
-
const duration = durationMs / 1000;
|
|
377
|
-
const padding = paddingPx ? [
|
|
378
|
-
paddingPx[0] < this._container.clientWidth / 2 ? paddingPx[0] : this._container.clientWidth / 2,
|
|
379
|
-
paddingPx[1] < this._container.clientHeight / 2 ? paddingPx[1] : this._container.clientHeight / 2,
|
|
380
|
-
] : undefined;
|
|
381
|
-
if (duration) {
|
|
382
|
-
this._map.leaflet.flyToBounds(bounds, { duration, padding });
|
|
383
|
-
}
|
|
384
|
-
else {
|
|
385
|
-
this._map.leaflet.fitBounds(bounds, { padding });
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
_renderData(mapMoveZoomUpdateOnly = false) {
|
|
389
|
-
var _a;
|
|
390
|
-
const { config } = this;
|
|
391
|
-
const pointData = this._getPointData();
|
|
392
|
-
const contentBBox = pointData.length ? bBoxMerge(pointData.map(d => d.bbox)) : { x: 0, y: 0, width: 0, height: 0 };
|
|
393
|
-
// Set SVG size to match Leaflet transform
|
|
394
|
-
const svgExtraPadding = 40 + this._clusterBackgroundRadius; // We need it to fit point labels and expanded cluster background circle
|
|
395
|
-
const dx = contentBBox.x - svgExtraPadding;
|
|
396
|
-
const dy = contentBBox.y - svgExtraPadding;
|
|
397
|
-
this._map.svgOverlay
|
|
398
|
-
.attr('width', contentBBox.width + 2 * svgExtraPadding)
|
|
399
|
-
.attr('height', contentBBox.height + 2 * svgExtraPadding)
|
|
400
|
-
.style('left', `${dx}px`)
|
|
401
|
-
.style('top', `${dy}px`);
|
|
402
|
-
this._map.svgGroup
|
|
403
|
-
.attr('transform', `translate(${-dx},${-dy})`);
|
|
404
|
-
// Render content
|
|
405
|
-
const points = this._pointGroup.selectAll(`.${point}:not(.exit)`)
|
|
406
|
-
.data(pointData, (d, i) => `${d.id || d.geometry.coordinates.join('')}`);
|
|
407
|
-
points.exit().classed('exit', true).call(removeNodes);
|
|
408
|
-
const pointsEnter = points.enter().append('g').attr('class', point)
|
|
409
|
-
.call(createNodes);
|
|
410
|
-
const pointsMerged = points.merge(pointsEnter);
|
|
411
|
-
pointsEnter.call(updateNodes, config, this._map.leaflet);
|
|
412
|
-
points.call(updateNodes, config, this._map.leaflet, mapMoveZoomUpdateOnly);
|
|
413
|
-
pointsMerged.call(collideLabels, this._map.leaflet);
|
|
414
|
-
this._clusterBackground.call(updateBackgroundNode, this._expandedCluster, config, this._map.leaflet, this._clusterBackgroundRadius);
|
|
415
|
-
if (this._expandedCluster && config.clusterBackground) {
|
|
416
|
-
pointData.forEach((d, i) => { var _a; d._zIndex = ((_a = d.properties) === null || _a === void 0 ? void 0 : _a.expandedClusterPoint) ? 2 : 0; });
|
|
417
|
-
this._pointGroup
|
|
418
|
-
.selectAll(`.${point}, .${clusterBackground}, .${pointSelectionRing}`)
|
|
419
|
-
.sort((a, b) => a._zIndex - b._zIndex);
|
|
420
|
-
}
|
|
421
|
-
// Show selection border and hide it when the node
|
|
422
|
-
// is out of visible box
|
|
423
|
-
if (config.selectedPointId) {
|
|
424
|
-
const foundPoint = pointData.find(d => getString(d.properties, config.pointId) === config.selectedPointId);
|
|
425
|
-
const { cluster } = findPointAndClusterByPointId(pointData, config.selectedPointId, config.pointId);
|
|
426
|
-
if (foundPoint)
|
|
427
|
-
this._selectedPoint = foundPoint;
|
|
428
|
-
else
|
|
429
|
-
this._selectedPoint = cluster;
|
|
430
|
-
}
|
|
431
|
-
this._pointSelectionRing.call(updateNodeSelectionRing, this._selectedPoint, pointData, config, this._map.leaflet);
|
|
432
|
-
// Set up events and attributes for the rendered points
|
|
433
|
-
this._setUpComponentEventsThrottled();
|
|
434
|
-
this._setCustomAttributesThrottled();
|
|
435
|
-
// Tooltip
|
|
436
|
-
(_a = config.tooltip) === null || _a === void 0 ? void 0 : _a.update();
|
|
437
|
-
}
|
|
438
|
-
_zoomToExternallySelectedPoint() {
|
|
439
|
-
const { config } = this;
|
|
440
|
-
if (!this._externallySelectedPoint)
|
|
441
|
-
return;
|
|
442
|
-
const externallySelectedPointDatum = this._externallySelectedPoint.properties;
|
|
443
|
-
const externallySelectedPointId = getString(externallySelectedPointDatum, config.pointId);
|
|
444
|
-
const pointData = this._getPointData();
|
|
445
|
-
const foundPoint = pointData.find(d => getString(d.properties, config.pointId) === externallySelectedPointId);
|
|
446
|
-
if (foundPoint) {
|
|
447
|
-
this._zoomingToExternallySelectedPoint = false;
|
|
448
|
-
this._currentZoomLevel = null;
|
|
449
|
-
}
|
|
450
|
-
else {
|
|
451
|
-
const { cluster } = findPointAndClusterByPointId(pointData, externallySelectedPointId, config.pointId);
|
|
452
|
-
if (!cluster)
|
|
453
|
-
return;
|
|
454
|
-
const zoomLevel = this._map.leaflet.getZoom();
|
|
455
|
-
// Expand cluster or fly further
|
|
456
|
-
if (this._forceExpandCluster || shouldClusterExpand(cluster, zoomLevel, 8, 13)) {
|
|
457
|
-
this._expandCluster(cluster);
|
|
458
|
-
}
|
|
459
|
-
else {
|
|
460
|
-
const newZoomLevel = getNextZoomLevelOnClusterClick(zoomLevel);
|
|
461
|
-
const coordinates = {
|
|
462
|
-
lng: getNumber(externallySelectedPointDatum, config.pointLongitude),
|
|
463
|
-
lat: getNumber(externallySelectedPointDatum, config.pointLatitude),
|
|
464
|
-
};
|
|
465
|
-
if (this._currentZoomLevel !== newZoomLevel) {
|
|
466
|
-
this._currentZoomLevel = newZoomLevel;
|
|
467
|
-
this._eventInitiatedByComponent = true;
|
|
468
|
-
this._map.leaflet.flyTo(coordinates, newZoomLevel, { duration: 0 });
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
_expandCluster(clusterPoint, preventRender) {
|
|
474
|
-
var _a;
|
|
475
|
-
const { config, config: { clusterBackground } } = this;
|
|
476
|
-
const padding = 1;
|
|
477
|
-
(_a = config.tooltip) === null || _a === void 0 ? void 0 : _a.hide();
|
|
478
|
-
this._forceExpandCluster = false;
|
|
479
|
-
if (clusterPoint) {
|
|
480
|
-
const points = clusterPoint.clusterIndex.getLeaves(clusterPoint.properties.cluster_id, Infinity);
|
|
481
|
-
const packPoints = points.map(p => ({
|
|
482
|
-
x: null,
|
|
483
|
-
y: null,
|
|
484
|
-
r: getPointRadius(p, config.pointRadius, this._map.leaflet.getZoom()) + padding,
|
|
485
|
-
}));
|
|
486
|
-
packSiblings(packPoints);
|
|
487
|
-
points.forEach((p, i) => {
|
|
488
|
-
p.properties.expandedClusterPoint = clusterPoint;
|
|
489
|
-
p.properties.r = packPoints[i].r;
|
|
490
|
-
p.properties.dx = packPoints[i].x;
|
|
491
|
-
p.properties.dy = packPoints[i].y;
|
|
492
|
-
});
|
|
493
|
-
this._resetExpandedCluster();
|
|
494
|
-
this._expandedCluster = {
|
|
495
|
-
cluster: clusterPoint,
|
|
496
|
-
points,
|
|
497
|
-
};
|
|
498
|
-
if (clusterBackground)
|
|
499
|
-
this._clusterBackgroundRadius = getClusterRadius(this._expandedCluster);
|
|
500
|
-
if (!preventRender)
|
|
501
|
-
this._renderData();
|
|
502
|
-
}
|
|
503
|
-
this._zoomingToExternallySelectedPoint = false;
|
|
504
|
-
}
|
|
505
|
-
_resetExpandedCluster() {
|
|
506
|
-
var _a, _b;
|
|
507
|
-
(_b = (_a = this._expandedCluster) === null || _a === void 0 ? void 0 : _a.points) === null || _b === void 0 ? void 0 : _b.forEach(d => { delete d.properties.expandedClusterPoint; });
|
|
508
|
-
this._expandedCluster = null;
|
|
509
|
-
}
|
|
510
|
-
_getPointData(customBounds) {
|
|
511
|
-
const { config, datamodel: { data } } = this;
|
|
512
|
-
if (!data || !this._clusterIndex)
|
|
513
|
-
return [];
|
|
514
|
-
let geoJSONPoints = getClustersAndPoints(this._clusterIndex, this._map.leaflet, customBounds);
|
|
515
|
-
if (this._expandedCluster) {
|
|
516
|
-
// Remove expanded cluster from the data
|
|
517
|
-
geoJSONPoints = geoJSONPoints.filter(c => c.properties.cluster_id !== this._expandedCluster.cluster.properties.cluster_id);
|
|
518
|
-
// Add points from the expanded cluster
|
|
519
|
-
geoJSONPoints = geoJSONPoints.concat(this._expandedCluster.points);
|
|
520
|
-
}
|
|
521
|
-
const pointData = geoJSONPoints
|
|
522
|
-
// Todo: Remove explicitly set ClusterFeature<LeafletMapPointDatum<Datum>> type
|
|
523
|
-
.map((d, i) => {
|
|
524
|
-
return geoJsonPointToScreenPoint(d, i, this._map.leaflet, config);
|
|
525
|
-
});
|
|
526
|
-
// .sort((a, b) => getPointDisplayOrder(a, config.pointStatus, config.colorMap) - getPointDisplayOrder(b, config.pointStatus, config.colorMap))
|
|
527
|
-
return pointData;
|
|
528
|
-
}
|
|
529
|
-
_getMapZoomState() {
|
|
530
|
-
const leafletBounds = this._map.leaflet.getBounds();
|
|
531
|
-
const southWest = leafletBounds.getSouthWest();
|
|
532
|
-
const northEast = leafletBounds.getNorthEast();
|
|
533
|
-
return {
|
|
534
|
-
mapCenter: this._map.leaflet.getCenter(),
|
|
535
|
-
zoomLevel: this._map.leaflet.getZoom(),
|
|
536
|
-
bounds: { southWest, northEast },
|
|
537
|
-
userDriven: !this._eventInitiatedByComponent,
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
_onMapDragLeaflet() {
|
|
541
|
-
this._cancelBackgroundClick = true;
|
|
542
|
-
}
|
|
543
|
-
_onMapMove() {
|
|
544
|
-
var _a;
|
|
545
|
-
const { config } = this;
|
|
546
|
-
if (!this._map)
|
|
547
|
-
return;
|
|
548
|
-
this._hasBeenMoved = true;
|
|
549
|
-
this._renderDataAnimationFrameId = requestAnimationFrame(() => {
|
|
550
|
-
this._renderData(true);
|
|
551
|
-
});
|
|
552
|
-
(_a = config.onMapMoveZoom) === null || _a === void 0 ? void 0 : _a.call(config, this._getMapZoomState());
|
|
553
|
-
}
|
|
554
|
-
_onMapMoveStart() {
|
|
555
|
-
var _a;
|
|
556
|
-
const { config } = this;
|
|
557
|
-
if (!this._map)
|
|
558
|
-
return;
|
|
559
|
-
this._isMoving = true;
|
|
560
|
-
(_a = config.onMapMoveStart) === null || _a === void 0 ? void 0 : _a.call(config, this._getMapZoomState());
|
|
561
|
-
}
|
|
562
|
-
_onMapMoveEnd() {
|
|
563
|
-
var _a, _b;
|
|
564
|
-
const { config } = this;
|
|
565
|
-
if (!this._map)
|
|
566
|
-
return;
|
|
567
|
-
(_a = this._onMapMoveEndInternal) === null || _a === void 0 ? void 0 : _a.call(this, this._map.leaflet);
|
|
568
|
-
(_b = config.onMapMoveEnd) === null || _b === void 0 ? void 0 : _b.call(config, this._getMapZoomState());
|
|
569
|
-
constraintMapViewThrottled(this._map.leaflet);
|
|
570
|
-
const events = this._map.layer.getEvents();
|
|
571
|
-
if (events.zoomend) {
|
|
572
|
-
const zoomEndEvent = events.zoomend.bind(this._map.layer);
|
|
573
|
-
zoomEndEvent(null);
|
|
574
|
-
}
|
|
575
|
-
if (this._externallySelectedPoint || this._zoomingToExternallySelectedPoint) {
|
|
576
|
-
this._zoomToExternallySelectedPoint();
|
|
577
|
-
}
|
|
578
|
-
this._isMoving = false;
|
|
579
|
-
this._eventInitiatedByComponent = false;
|
|
580
|
-
}
|
|
581
|
-
_onMapZoomStart() {
|
|
582
|
-
var _a;
|
|
583
|
-
const { config } = this;
|
|
584
|
-
if (!this._map)
|
|
585
|
-
return;
|
|
586
|
-
this._isZooming = true;
|
|
587
|
-
(_a = config.onMapZoomStart) === null || _a === void 0 ? void 0 : _a.call(config, this._getMapZoomState());
|
|
588
|
-
}
|
|
589
|
-
_onMapZoomEnd() {
|
|
590
|
-
var _a;
|
|
591
|
-
const { config } = this;
|
|
592
|
-
if (!this._map)
|
|
593
|
-
return;
|
|
594
|
-
(_a = config.onMapZoomEnd) === null || _a === void 0 ? void 0 : _a.call(config, this._getMapZoomState());
|
|
595
|
-
this._isZooming = false;
|
|
596
|
-
if (!this._isMoving)
|
|
597
|
-
this._eventInitiatedByComponent = false;
|
|
598
|
-
}
|
|
599
|
-
_onMapZoom() {
|
|
600
|
-
var _a, _b;
|
|
601
|
-
const { config } = this;
|
|
602
|
-
if (!this._map)
|
|
603
|
-
return;
|
|
604
|
-
this._hasBeenZoomed = true;
|
|
605
|
-
if (!this._externallySelectedPoint)
|
|
606
|
-
this._resetExpandedCluster();
|
|
607
|
-
else if (!this._zoomingToExternallySelectedPoint) {
|
|
608
|
-
this._externallySelectedPoint = null;
|
|
609
|
-
}
|
|
610
|
-
(_a = config.tooltip) === null || _a === void 0 ? void 0 : _a.hide();
|
|
611
|
-
(_b = config.onMapMoveZoom) === null || _b === void 0 ? void 0 : _b.call(config, this._getMapZoomState());
|
|
612
|
-
}
|
|
613
|
-
_onBackgroundClick(el, event) {
|
|
614
|
-
var _a;
|
|
615
|
-
const { config } = this;
|
|
616
|
-
if (this._cancelBackgroundClick) {
|
|
617
|
-
this._cancelBackgroundClick = false;
|
|
618
|
-
return;
|
|
619
|
-
}
|
|
620
|
-
this._externallySelectedPoint = null;
|
|
621
|
-
this._resetExpandedCluster();
|
|
622
|
-
this._renderData();
|
|
623
|
-
(_a = config.onMapClick) === null || _a === void 0 ? void 0 : _a.call(config, this._getMapZoomState());
|
|
624
|
-
}
|
|
625
|
-
_onPointClick(d, event) {
|
|
626
|
-
const { config: { flyToDuration, clusterExpandOnClick } } = this;
|
|
627
|
-
this._externallySelectedPoint = null;
|
|
628
|
-
event.stopPropagation();
|
|
629
|
-
if (d.properties.cluster) {
|
|
630
|
-
const zoomLevel = this._map.leaflet.getZoom();
|
|
631
|
-
const coordinates = { lng: d.geometry.coordinates[0], lat: d.geometry.coordinates[1] };
|
|
632
|
-
if (clusterExpandOnClick && shouldClusterExpand(d, zoomLevel))
|
|
633
|
-
this._expandCluster(d);
|
|
634
|
-
else {
|
|
635
|
-
const newZoomLevel = getNextZoomLevelOnClusterClick(zoomLevel);
|
|
636
|
-
this._eventInitiatedByComponent = true;
|
|
637
|
-
this._map.leaflet.flyTo(coordinates, newZoomLevel, { duration: flyToDuration / 1000 });
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
_onPointMouseDown(d, event) {
|
|
642
|
-
this._cancelBackgroundClick = true;
|
|
643
|
-
}
|
|
644
|
-
_onPointMouseUp(d, event) {
|
|
645
|
-
this._cancelBackgroundClick = false;
|
|
646
|
-
}
|
|
647
|
-
zoomIn(increment = 1) {
|
|
648
|
-
var _a;
|
|
649
|
-
if (!((_a = this._map) === null || _a === void 0 ? void 0 : _a.leaflet))
|
|
650
|
-
return;
|
|
651
|
-
this.setZoom(this._map.leaflet.getZoom() + increment);
|
|
652
|
-
}
|
|
653
|
-
zoomOut(increment = 1) {
|
|
654
|
-
var _a;
|
|
655
|
-
if (!((_a = this._map) === null || _a === void 0 ? void 0 : _a.leaflet))
|
|
656
|
-
return;
|
|
657
|
-
this.setZoom(this._map.leaflet.getZoom() - increment);
|
|
658
|
-
}
|
|
659
|
-
setZoom(zoomLevel) {
|
|
660
|
-
var _a;
|
|
661
|
-
const leaflet = (_a = this._map) === null || _a === void 0 ? void 0 : _a.leaflet;
|
|
662
|
-
if (!leaflet)
|
|
663
|
-
return;
|
|
664
|
-
this._eventInitiatedByComponent = true;
|
|
665
|
-
leaflet.flyTo(leaflet.getCenter(), clamp(zoomLevel, leaflet.getMinZoom(), leaflet.getMaxZoom()), { duration: this.config.zoomDuration / 1000 });
|
|
666
|
-
}
|
|
667
|
-
fitView() {
|
|
668
|
-
this.fitToPoints();
|
|
669
|
-
}
|
|
670
|
-
destroy() {
|
|
671
|
-
var _a, _b;
|
|
672
|
-
constraintMapViewThrottled.cancel();
|
|
673
|
-
cancelAnimationFrame(this._renderDataAnimationFrameId);
|
|
674
|
-
cancelAnimationFrame(this._flyToBoundsAnimationFrameId);
|
|
675
|
-
const map = (_a = this._map) === null || _a === void 0 ? void 0 : _a.leaflet;
|
|
676
|
-
this._map = undefined;
|
|
677
|
-
map === null || map === void 0 ? void 0 : map.stop();
|
|
678
|
-
map === null || map === void 0 ? void 0 : map.remove();
|
|
679
|
-
this.g.remove();
|
|
680
|
-
this.resizeObserver.disconnect();
|
|
681
|
-
(_b = this.themeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
LeafletMap.selectors = style;
|
|
685
|
-
LeafletMap.cssVariables = variables;
|
|
686
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
687
|
-
LeafletMap.DEFAULT_CONTAINER_HEIGHT = 600;
|
|
688
|
-
|
|
689
|
-
export { LeafletMap };
|
|
690
|
-
//# sourceMappingURL=index.js.map
|