@longline/aqua-ui 1.0.339 → 1.0.340
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/containers/Anchor/Anchor.d.ts +5 -0
- package/containers/Anchor/Anchor.js +20 -8
- package/containers/Dock/Dock.d.ts +5 -0
- package/containers/Dock/Dock.js +1 -1
- package/containers/Dock/Dockable.d.ts +5 -0
- package/containers/Dock/Dockable.js +20 -12
- package/containers/DragBar/DragBar.d.ts +5 -0
- package/containers/DragBar/DragBar.js +16 -5
- package/containers/Form/Field.d.ts +0 -3
- package/containers/Form/Field.js +3 -6
- package/containers/Form/Form.js +5 -36
- package/containers/Form/Validation.d.ts +1 -1
- package/containers/Form/Validation.js +6 -6
- package/containers/Form/context/FormContext.d.ts +1 -2
- package/containers/Form/context/useForm.d.ts +1 -1
- package/containers/Form/elements/BoxWrapper.js +2 -0
- package/containers/GlassPane/GlassPane.d.ts +7 -2
- package/containers/GlassPane/GlassPane.js +3 -3
- package/containers/InfoBox/InfoBox.d.ts +5 -0
- package/containers/InfoBox/InfoBox.js +1 -1
- package/containers/List/List.d.ts +5 -0
- package/containers/List/List.js +1 -1
- package/containers/List/ListCell.d.ts +5 -0
- package/containers/List/ListCell.js +1 -1
- package/containers/List/ListRow.d.ts +7 -2
- package/containers/List/ListRow.js +1 -1
- package/containers/Message/Error.d.ts +2 -0
- package/containers/Message/Error.js +1 -1
- package/containers/Message/Message.d.ts +5 -0
- package/containers/Message/Message.js +1 -1
- package/containers/Message/NoData.d.ts +2 -0
- package/containers/Message/NoData.js +1 -1
- package/containers/Message/NoFilteredData.d.ts +2 -0
- package/containers/Message/NoFilteredData.js +1 -1
- package/containers/Openable/Openable.d.ts +5 -0
- package/containers/Openable/Openable.js +8 -8
- package/containers/PublicRoute/PublicRoute.d.ts +9 -1
- package/containers/PublicRoute/PublicRoute.js +3 -7
- package/containers/Tabs/Pane.d.ts +5 -0
- package/containers/Tabs/Pane.js +3 -3
- package/containers/Tabs/Tabs.d.ts +5 -0
- package/containers/Tabs/Tabs.js +3 -3
- package/controls/Chip/Chip.d.ts +15 -3
- package/controls/Chip/Chip.js +7 -6
- package/controls/CircularProgress/CircularProgress.d.ts +11 -0
- package/controls/CircularProgress/CircularProgress.js +19 -11
- package/controls/Dropzone/Dropzone.d.ts +11 -1
- package/controls/Dropzone/Dropzone.js +18 -7
- package/controls/Fab/Fab.d.ts +14 -6
- package/controls/Fab/Fab.js +7 -20
- package/controls/Ghost/Ghost.js +3 -3
- package/controls/Gradient/Gradient.d.ts +5 -0
- package/controls/Gradient/Gradient.js +7 -4
- package/controls/Histogram/Histogram.d.ts +8 -2
- package/controls/Histogram/Histogram.js +9 -9
- package/controls/Histogram/HistogramBar.d.ts +2 -2
- package/controls/Icon/Icon.d.ts +10 -4
- package/controls/Icon/Icon.js +23 -6
- package/controls/Key/Key.d.ts +5 -0
- package/controls/Key/Key.js +2 -5
- package/controls/LinearChart/LinearChart.d.ts +9 -0
- package/controls/LinearChart/LinearChart.js +11 -6
- package/controls/ListButton/ListButton.d.ts +46 -3
- package/controls/ListButton/ListButton.js +70 -9
- package/controls/ListView/ColumnsManager/ColumnDraggable.js +11 -5
- package/controls/ListView/ColumnsManager/SourceColumns.js +1 -1
- package/controls/ListView/IListViewProps.d.ts +9 -2
- package/controls/ListView/ListView.js +13 -12
- package/controls/ListView/defaults.d.ts +3 -0
- package/controls/ListView/defaults.js +6 -0
- package/controls/ListView/elements/Body.d.ts +1 -1
- package/controls/ListView/elements/Body.js +23 -12
- package/controls/ListView/elements/Ghost.js +3 -2
- package/controls/ListView/elements/Header.js +3 -2
- package/controls/ListView/elements/HeaderCell.js +3 -3
- package/controls/ListView/elements/Table.js +16 -10
- package/controls/Mouse/Mouse.d.ts +6 -4
- package/controls/Mouse/Mouse.js +15 -8
- package/controls/PrimaryButton/PrimaryButton.d.ts +9 -3
- package/controls/PrimaryButton/PrimaryButton.js +5 -5
- package/controls/Progress/Progress.d.ts +9 -0
- package/controls/Progress/Progress.js +12 -8
- package/controls/SecondaryButton/SecondaryButton.d.ts +8 -3
- package/controls/SecondaryButton/SecondaryButton.js +1 -1
- package/controls/SpeechRecognizer/EditorRegistry.js +1 -2
- package/controls/SpeechRecognizer/SpeechRecognizer.d.ts +9 -1
- package/controls/SpeechRecognizer/SpeechRecognizer.js +16 -9
- package/controls/TabBar/TabBar.d.ts +5 -0
- package/controls/TabBar/TabBar.js +14 -6
- package/controls/TabBar/Underliner.js +1 -1
- package/controls/TertiaryButton/TertiaryButton.d.ts +9 -3
- package/controls/TertiaryButton/TertiaryButton.js +5 -3
- package/controls/ToggleButton/ToggleButton.d.ts +8 -2
- package/controls/ToggleButton/ToggleButton.js +1 -1
- package/controls/View/View.d.ts +5 -0
- package/controls/View/View.js +1 -1
- package/formatters/CountryFormatter/CountryFormatter.d.ts +3 -2
- package/formatters/CountryFormatter/CountryUtil.d.ts +3 -3
- package/formatters/DateTimeFormatter/DateTimeFormatter.d.ts +11 -10
- package/formatters/DateTimeFormatter/elements/Custom.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/DistanceDate.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/LongDate.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/LongDateTime.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/LongTime.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/Month.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/ShortDate.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/ShortDateTime.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/ShortTime.d.ts +1 -1
- package/formatters/DivisionFormatter/DivisionFormatter.d.ts +2 -2
- package/formatters/DivisionFormatter/DivisionFormatter.js +1 -1
- package/formatters/DivisionFormatter/DivisionUtil.d.ts +1 -1
- package/formatters/DivisionFormatter/DivisionUtil.js +5 -3
- package/formatters/FilesizeFormatter/FilesizeFormatter.d.ts +3 -3
- package/formatters/GIS/CoordinateFormatter.d.ts +2 -2
- package/formatters/GIS/LatitudeFormatter.d.ts +2 -2
- package/formatters/GIS/LongitudeFormatter.d.ts +2 -2
- package/formatters/HumanFormatter/HumanFormatter.d.ts +3 -3
- package/formatters/NumberFormatter/NumberFormatter.d.ts +3 -3
- package/formatters/PhoneFormatter/PhoneFormatter.d.ts +3 -3
- package/formatters/StringFormatter/StringFormatter.d.ts +3 -3
- package/formatters/StringFormatter/StringFormatter.js +1 -4
- package/helper/DMS.d.ts +1 -1
- package/helper/DMS.js +2 -2
- package/hooks/useOutsideClose/useOutsideClose.js +20 -11
- package/hooks/useSpeechAIRecorder/useSpeechAIRecorder.js +10 -7
- package/index.js +1 -0
- package/inputs/DateInput/Body.d.ts +2 -2
- package/inputs/DateInput/Body.js +11 -7
- package/inputs/DateInput/Calendar.d.ts +1 -1
- package/inputs/DateInput/Calendar.js +3 -5
- package/inputs/DateInput/DateInput.d.ts +11 -3
- package/inputs/DateInput/DateInput.js +11 -3
- package/inputs/DateInput/Day.d.ts +1 -1
- package/inputs/DateInput/InfiniteList.js +6 -3
- package/inputs/DateInput/Navbar.js +3 -2
- package/inputs/DateInput/NumericInput.js +3 -0
- package/inputs/DateInput/Selector.d.ts +1 -1
- package/inputs/DateInput/Selector.js +9 -6
- package/inputs/Dropdown/Body.d.ts +2 -2
- package/inputs/Dropdown/Column.d.ts +1 -1
- package/inputs/Dropdown/Dropdown.d.ts +5 -0
- package/inputs/Dropdown/Dropdown.js +36 -63
- package/inputs/Dropdown/Pill.js +1 -1
- package/inputs/Dropdown/Selection.js +1 -1
- package/inputs/Editor/Editor.d.ts +5 -0
- package/inputs/Editor/Editor.js +16 -6
- package/inputs/Editor/buttons/SpeechAIButton.js +2 -0
- package/inputs/Editor/buttons/TextAIButton.d.ts +0 -13
- package/inputs/Editor/buttons/TextAIButton.js +30 -14
- package/inputs/Editor/buttons/TextAIMenu.js +1 -1
- package/inputs/Editor/menu/MenuBar.d.ts +1 -1
- package/inputs/Editor/menu/MenuBar.js +1 -1
- package/inputs/Editor/menu/MenuButton.js +1 -1
- package/inputs/Input/Clear.js +1 -1
- package/inputs/Input/Input.d.ts +5 -0
- package/inputs/Input/Input.js +8 -6
- package/inputs/Input/InputWrapper.d.ts +2 -0
- package/inputs/Input/InputWrapper.js +1 -1
- package/inputs/Input/Reveal.js +1 -1
- package/inputs/MonthRange/Body.d.ts +1 -1
- package/inputs/MonthRange/Calendar.d.ts +2 -2
- package/inputs/MonthRange/Calendar.js +6 -9
- package/inputs/MonthRange/MonthRange.d.ts +7 -1
- package/inputs/MonthRange/MonthRange.js +14 -6
- package/inputs/MonthRange/Selector.d.ts +1 -1
- package/inputs/MonthRange/Selector.js +12 -11
- package/inputs/PhoneInput/PhoneInput.d.ts +5 -0
- package/inputs/PhoneInput/PhoneInput.js +2 -2
- package/inputs/Selector/Selector.d.ts +5 -0
- package/inputs/Selector/Selector.js +4 -1
- package/inputs/Slider/Slider.d.ts +75 -22
- package/inputs/Slider/Slider.js +104 -22
- package/inputs/Textarea/Textarea.d.ts +5 -5
- package/inputs/Textarea/Textarea.js +3 -2
- package/map/Map/Map.d.ts +2 -2
- package/map/Map/Map.js +20 -14
- package/map/PositionsManager/PositionBox.js +7 -3
- package/map/PositionsManager/PositionsManager.js +33 -13
- package/map/controls/CompassButton/CompassButton.js +1 -1
- package/map/controls/FullscreenButton/FullscreenButton.js +1 -1
- package/map/controls/Geocoder/Geocoder.js +28 -14
- package/map/controls/Geocoder/GeocoderApi.js +2 -0
- package/map/controls/Geocoder/GeocoderSelector.js +1 -1
- package/map/controls/Graticule/Graticule.js +1 -5
- package/map/controls/MapLoader/MapLoader.js +1 -1
- package/map/controls/ScaleControl/ScaleControl.js +1 -1
- package/map/controls/ZoomInButton/ZoomInButton.js +1 -1
- package/map/controls/ZoomOutButton/ZoomOutButton.d.ts +1 -1
- package/map/controls/ZoomOutButton/ZoomOutButton.js +2 -2
- package/map/controls/base/MapButton/MapButton.d.ts +8 -2
- package/map/controls/base/MapButton/MapButton.js +11 -2
- package/map/controls/base/MapControl/MapControl.d.ts +5 -0
- package/map/controls/base/MapControl/MapControl.js +10 -7
- package/map/layers/ClusterLayer/ClusterLayer.d.ts +1 -1
- package/map/layers/ClusterLayer/ClusterLayer.js +7 -3
- package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer.js +8 -4
- package/map/layers/IdwBlendLayer/IdwBlendLayer.js +9 -4
- package/map/layers/IdwLayer/IdwLayer.d.ts +2 -1
- package/map/layers/IdwLayer/IdwLayer.js +271 -215
- package/map/layers/InterpolationLayer/ContoursFragmentShader.d.ts +1 -1
- package/map/layers/InterpolationLayer/ContoursFragmentShader.js +1 -1
- package/map/layers/InterpolationLayer/InterpolationLayer.d.ts +4 -3
- package/map/layers/InterpolationLayer/InterpolationLayer.js +362 -275
- package/map/layers/ParticlesLayer/ParticlesLayer.d.ts +8 -7
- package/map/layers/ParticlesLayer/ParticlesLayer.js +528 -404
- package/map/markers/ClusterMarker/ClusterMarker.d.ts +6 -1
- package/map/markers/ClusterMarker/ClusterMarker.js +15 -6
- package/map/markers/RiskMarker/RiskMarker.d.ts +5 -1
- package/map/markers/RiskMarker/RiskMarker.js +4 -4
- package/modules/CountryDropdown/CountryDropdown.js +10 -1
- package/modules/Filter/Filter.d.ts +5 -0
- package/modules/Filter/Filter.js +10 -6
- package/modules/Globe/Globe.d.ts +5 -0
- package/modules/Globe/Globe.js +4 -4
- package/modules/MainMenu/Item.d.ts +9 -2
- package/modules/MainMenu/Item.js +8 -5
- package/modules/MainMenu/MainMenu.d.ts +5 -0
- package/modules/MainMenu/MainMenu.js +1 -1
- package/modules/ParticleGlobe/GL.d.ts +1 -1
- package/modules/ParticleGlobe/ParticleGlobe.d.ts +5 -0
- package/modules/ParticleGlobe/ParticleGlobe.js +69 -40
- package/modules/Public/Public.d.ts +5 -0
- package/modules/Public/Public.js +3 -3
- package/package.json +1 -1
- package/services/Auth/Auth.js +13 -7
- package/services/Auth/AuthContext.js +9 -1
- package/services/Dialog/Dialog.d.ts +7 -2
- package/services/Dialog/Dialog.js +7 -6
- package/services/Dialog/DialogWindow.d.ts +3 -1
- package/services/Dialog/DialogWindow.js +1 -1
- package/services/Dialog/XhrDialog.d.ts +1 -1
- package/services/Toast/Toast.js +5 -3
- package/services/Toast/ToastContainer.js +3 -1
- package/services/Toast/ToastContext.d.ts +1 -1
- package/services/Toast/ToastProvider.js +2 -0
- package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer copy.d.ts +0 -35
- package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer copy.js +0 -176
- package/modules/Root/Content.d.ts +0 -16
- package/modules/Root/Content.js +0 -25
- package/modules/Root/Overlay.d.ts +0 -23
- package/modules/Root/Overlay.js +0 -33
- package/modules/Root/Root.d.ts +0 -10
- package/modules/Root/Root.js +0 -46
- package/modules/Root/Shader.d.ts +0 -15
- package/modules/Root/Shader.js +0 -24
- package/modules/Root/Sidebar.d.ts +0 -13
- package/modules/Root/Sidebar.js +0 -24
- package/modules/Root/index.d.ts +0 -1
- package/modules/Root/index.js +0 -1
- package/modules/Root/stories/SampleContent.d.ts +0 -7
- package/modules/Root/stories/SampleContent.js +0 -44
|
@@ -24,13 +24,15 @@ import * as React from 'react';
|
|
|
24
24
|
import { Source, useMap } from 'react-map-gl/mapbox';
|
|
25
25
|
import { HtmlMarkerLayer } from '../HtmlMarkerLayer/HtmlMarkerLayer';
|
|
26
26
|
import { ClusterMarker } from '../../markers/ClusterMarker';
|
|
27
|
+
// Default cluster radius in pixels (see IClusterLayerProps.radius).
|
|
28
|
+
var DEFAULT_RADIUS = 24;
|
|
27
29
|
function uuidv4() {
|
|
28
30
|
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, function (c) {
|
|
29
31
|
return (+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4).toString(16);
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
34
|
var ClusterLayerBase = function (_a) {
|
|
33
|
-
var _b = _a.relativeSize, relativeSize = _b === void 0 ? 0 : _b, _c = _a.radius, radius = _c === void 0 ?
|
|
35
|
+
var _b = _a.relativeSize, relativeSize = _b === void 0 ? 0 : _b, _c = _a.radius, radius = _c === void 0 ? DEFAULT_RADIUS : _c, _d = _a.clusterRadius, clusterRadius = _d === void 0 ? 80 : _d, _e = _a.clusterMaxZoom, clusterMaxZoom = _e === void 0 ? 18 : _e, _f = _a.ringFields, ringFields = _f === void 0 ? [] : _f, _g = _a.clickZoom, clickZoom = _g === void 0 ? false : _g, props = __rest(_a, ["relativeSize", "radius", "clusterRadius", "clusterMaxZoom", "ringFields", "clickZoom"]);
|
|
34
36
|
var map = useMap().current;
|
|
35
37
|
// Generate a random, unique source ID:
|
|
36
38
|
var sourceId = React.useRef(uuidv4()).current;
|
|
@@ -68,6 +70,8 @@ var ClusterLayerBase = function (_a) {
|
|
|
68
70
|
return obj;
|
|
69
71
|
}, [props.aggregation, ringFields]);
|
|
70
72
|
var handleClick = function (longitude, latitude, cluster_id) {
|
|
73
|
+
if (!map)
|
|
74
|
+
return;
|
|
71
75
|
map.getSource(sourceId).getClusterExpansionZoom(cluster_id, function (err, zoom) {
|
|
72
76
|
if (err)
|
|
73
77
|
return;
|
|
@@ -79,7 +83,7 @@ var ClusterLayerBase = function (_a) {
|
|
|
79
83
|
};
|
|
80
84
|
return (React.createElement(Source, { id: sourceId, type: 'geojson', data: itemsToFeatures, cluster: true, clusterRadius: clusterRadius, clusterMaxZoom: clusterMaxZoom, clusterProperties: __assign({}, clusterProperties) },
|
|
81
85
|
React.createElement(HtmlMarkerLayer, { sourceId: sourceId, idField: "cluster_id", minZoom: props.minZoom, maxZoom: props.maxZoom }, function (markerProps) {
|
|
82
|
-
return React.createElement(ClusterMarker, __assign({ relativeSize: relativeSize, radius: radius, value: props.aggregation ? markerProps['sum'] : markerProps['point_count'], ringValues: ringFields.map(function (f) { return markerProps[f]; }), onClick: clickZoom ? function () { return handleClick(markerProps.longitude, markerProps.latitude, markerProps.cluster_id); } : null }, markerProps));
|
|
86
|
+
return React.createElement(ClusterMarker, __assign({ relativeSize: relativeSize, radius: radius, value: props.aggregation ? markerProps['sum'] : markerProps['point_count'], decimals: props.decimals, ringValues: ringFields.map(function (f) { return markerProps[f]; }), onClick: clickZoom ? function () { return handleClick(markerProps.longitude, markerProps.latitude, markerProps.cluster_id); } : null }, markerProps));
|
|
83
87
|
})));
|
|
84
88
|
};
|
|
85
89
|
/**
|
|
@@ -106,7 +110,7 @@ var ClusterLayerBase = function (_a) {
|
|
|
106
110
|
* ```
|
|
107
111
|
*/
|
|
108
112
|
var ClusterLayer = function (_a) {
|
|
109
|
-
var _b = _a.relativeSize, relativeSize = _b === void 0 ? 0 : _b, _c = _a.radius, radius = _c === void 0 ?
|
|
113
|
+
var _b = _a.relativeSize, relativeSize = _b === void 0 ? 0 : _b, _c = _a.radius, radius = _c === void 0 ? DEFAULT_RADIUS : _c, _d = _a.clusterRadius, clusterRadius = _d === void 0 ? 80 : _d, _e = _a.clusterMaxZoom, clusterMaxZoom = _e === void 0 ? 18 : _e, _f = _a.minZoom, minZoom = _f === void 0 ? 0 : _f, _g = _a.maxZoom, maxZoom = _g === void 0 ? 99 : _g, _h = _a.decimals, decimals = _h === void 0 ? 0 : _h, ringFields = _a.ringFields, _j = _a.clickZoom, clickZoom = _j === void 0 ? false : _j, props = __rest(_a, ["relativeSize", "radius", "clusterRadius", "clusterMaxZoom", "minZoom", "maxZoom", "decimals", "ringFields", "clickZoom"]);
|
|
110
114
|
var _k = React.useState(0), key = _k[0], setKey = _k[1];
|
|
111
115
|
// When aggregation changes, we mount a whole new component. Mapbox does not
|
|
112
116
|
// appear to deal with changes to clusterProperties well.
|
|
@@ -65,6 +65,8 @@ var HtmlMarkerLayerBase = function (_a) {
|
|
|
65
65
|
var childrenFn = React.useRef(children);
|
|
66
66
|
var ensureMarker = React.useCallback(function (feature) {
|
|
67
67
|
var _a, _b, _c, _d, _e;
|
|
68
|
+
if (!map)
|
|
69
|
+
return undefined;
|
|
68
70
|
var id = feature.properties[idField];
|
|
69
71
|
if (!id)
|
|
70
72
|
return undefined;
|
|
@@ -87,7 +89,9 @@ var HtmlMarkerLayerBase = function (_a) {
|
|
|
87
89
|
return marker;
|
|
88
90
|
}, [idField, map]);
|
|
89
91
|
var updateMarkers = React.useCallback(function () {
|
|
90
|
-
var _a, _b;
|
|
92
|
+
var _a, _b, _c;
|
|
93
|
+
if (!map)
|
|
94
|
+
return;
|
|
91
95
|
if (!map.getSource(sourceId))
|
|
92
96
|
return;
|
|
93
97
|
if (!map.isSourceLoaded(sourceId))
|
|
@@ -116,7 +120,7 @@ var HtmlMarkerLayerBase = function (_a) {
|
|
|
116
120
|
var newVisible = {};
|
|
117
121
|
for (var _i = 0, features_1 = features; _i < features_1.length; _i++) {
|
|
118
122
|
var feature = features_1[_i];
|
|
119
|
-
var id = feature.properties[idField];
|
|
123
|
+
var id = (_b = feature.properties) === null || _b === void 0 ? void 0 : _b[idField];
|
|
120
124
|
var marker = ensureMarker(feature);
|
|
121
125
|
if (marker)
|
|
122
126
|
newVisible[id] = marker;
|
|
@@ -124,7 +128,7 @@ var HtmlMarkerLayerBase = function (_a) {
|
|
|
124
128
|
for (var id in visibleRef.current) {
|
|
125
129
|
if (!newVisible[id]) {
|
|
126
130
|
visibleRef.current[id].remove();
|
|
127
|
-
(
|
|
131
|
+
(_c = rootsRef.current[id]) === null || _c === void 0 ? void 0 : _c.unmount();
|
|
128
132
|
delete markersRef.current[id];
|
|
129
133
|
delete rootsRef.current[id];
|
|
130
134
|
}
|
|
@@ -147,7 +151,7 @@ var HtmlMarkerLayerBase = function (_a) {
|
|
|
147
151
|
return function () {
|
|
148
152
|
map.off('sourcedata', onSourceData);
|
|
149
153
|
map.off('render', onRender);
|
|
150
|
-
//
|
|
154
|
+
// Defer cleanup until after React has finished unmounting.
|
|
151
155
|
requestAnimationFrame(function () {
|
|
152
156
|
var _a;
|
|
153
157
|
for (var id in markersRef.current) {
|
|
@@ -27,6 +27,10 @@ import { VertexShader } from './VertexShader';
|
|
|
27
27
|
import { FragmentShader } from './FragmentShader';
|
|
28
28
|
import { RgbColor } from '../../../helper/RgbColor';
|
|
29
29
|
import { PresetGradients } from '../../../controls/Gradient';
|
|
30
|
+
// Default prop values, referenced both by the IdwBlendLayerBase fallbacks and
|
|
31
|
+
// the IdwBlendLayer wrapper below.
|
|
32
|
+
var DEFAULT_MIN_ZOOM = 0;
|
|
33
|
+
var DEFAULT_MAX_ZOOM = 99;
|
|
30
34
|
var IdwBlendLayerBase = function (props) {
|
|
31
35
|
var map = useMap();
|
|
32
36
|
var discProgram = React.useRef(null);
|
|
@@ -92,11 +96,12 @@ var IdwBlendLayerBase = function (props) {
|
|
|
92
96
|
discBuffer.current = createPointsBuffer(gl, props.data);
|
|
93
97
|
};
|
|
94
98
|
var onRender = function (gl, matrix, zoom, width, height) {
|
|
99
|
+
var _a, _b;
|
|
95
100
|
// Render is called many times while the map is panned/zoomed.
|
|
96
101
|
// You cannot have access to the map though.
|
|
97
|
-
if (zoom < props.minZoom)
|
|
102
|
+
if (zoom < ((_a = props.minZoom) !== null && _a !== void 0 ? _a : DEFAULT_MIN_ZOOM))
|
|
98
103
|
return;
|
|
99
|
-
if (zoom > props.maxZoom)
|
|
104
|
+
if (zoom > ((_b = props.maxZoom) !== null && _b !== void 0 ? _b : DEFAULT_MAX_ZOOM))
|
|
100
105
|
return;
|
|
101
106
|
// Render is called many times while the map is panned/zoomed.
|
|
102
107
|
// You cannot have access to the map though.
|
|
@@ -115,14 +120,14 @@ var IdwBlendLayerBase = function (props) {
|
|
|
115
120
|
//gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
116
121
|
gl.drawArrays(gl.TRIANGLE_STRIP, 0, props.data.length * 4);
|
|
117
122
|
};
|
|
118
|
-
return (React.createElement(Layer, { id:
|
|
123
|
+
return (React.createElement(Layer, { id: "", type: "custom", beforeId: "overlay", key: time, onAdd: onAddLayer, render: function (gl, matrix) { return onRender(gl, matrix, map.current.getZoom(), map.current.getContainer().clientWidth, map.current.getContainer().clientHeight); } }));
|
|
119
124
|
};
|
|
120
125
|
/**
|
|
121
126
|
* An `IdwLayer` takes a data array of the form `{ latitude, longitude, value }`,
|
|
122
127
|
* and renders a colored surface using inverse distance weighting.
|
|
123
128
|
*/
|
|
124
129
|
var IdwBlendLayer = function (_a) {
|
|
125
|
-
var _b = _a.gradientStops, gradientStops = _b === void 0 ? PresetGradients.Blue : _b, _c = _a.minZoom, minZoom = _c === void 0 ?
|
|
130
|
+
var _b = _a.gradientStops, gradientStops = _b === void 0 ? PresetGradients.Blue : _b, _c = _a.minZoom, minZoom = _c === void 0 ? DEFAULT_MIN_ZOOM : _c, _d = _a.maxZoom, maxZoom = _d === void 0 ? DEFAULT_MAX_ZOOM : _d, _e = _a.maxDistance, maxDistance = _e === void 0 ? 0.0002 : _e, _f = _a.fadeFraction, fadeFraction = _f === void 0 ? 0.15 : _f, props = __rest(_a, ["gradientStops", "minZoom", "maxZoom", "maxDistance", "fadeFraction"]);
|
|
126
131
|
return React.createElement(IdwBlendLayerBase, __assign({ gradientStops: gradientStops, minZoom: minZoom, maxZoom: maxZoom, maxDistance: maxDistance, fadeFraction: fadeFraction }, props));
|
|
127
132
|
};
|
|
128
133
|
IdwBlendLayer.displayName = 'IdwBlendLayer';
|
|
@@ -31,7 +31,8 @@ interface IIdwLayerProps {
|
|
|
31
31
|
*/
|
|
32
32
|
maxDistance?: number;
|
|
33
33
|
/**
|
|
34
|
-
* Thickness of fading edge of blob
|
|
34
|
+
* Thickness of fading edge of blob, as a fraction of `maxDistance`,
|
|
35
|
+
* clamped to the range 0..1.
|
|
35
36
|
* @default 0.15
|
|
36
37
|
*/
|
|
37
38
|
fadeFraction?: number;
|