@mapcomponents/react-maplibre 0.1.56 → 0.1.57
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/CHANGELOG.md +7 -0
- package/coverage/clover.xml +6 -6
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/index.html +11 -11
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCenterPosition/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +1 -1
- package/coverage/lcov-report/src/components/MlGPXViewer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +7 -7
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +11 -11
- package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +1 -1
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +1 -1
- package/coverage/lcov-report/src/contexts/MapContext.tsx.html +1 -1
- package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
- package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
- package/coverage/lcov-report/src/contexts/index.html +1 -1
- package/coverage/lcov-report/src/hooks/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useLayer.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useMap.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useMapState.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useWms.js.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +5 -2
- package/coverage/lcov.info +2 -2
- package/dist/decorators/ThemeWrapper.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +230 -127
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/MlScaleReference/MlScaleReference.stories.js +22 -24
- package/src/decorators/MapContextDecorator.js +4 -6
- package/src/decorators/ThemeWrapper.jsx +9 -0
- package/src/index.ts +1 -0
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
147
147
|
Code coverage generated by
|
|
148
148
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
149
|
-
at
|
|
149
|
+
at Tue Aug 30 2022 13:27:18 GMT+0000 (Coordinated Universal Time)
|
|
150
150
|
</div>
|
|
151
151
|
<script src="../../prettify.js"></script>
|
|
152
152
|
<script>
|
|
@@ -664,7 +664,7 @@ export default useLayer;
|
|
|
664
664
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
665
665
|
Code coverage generated by
|
|
666
666
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
667
|
-
at
|
|
667
|
+
at Tue Aug 30 2022 13:27:18 GMT+0000 (Coordinated Universal Time)
|
|
668
668
|
</div>
|
|
669
669
|
<script src="../../prettify.js"></script>
|
|
670
670
|
<script>
|
|
@@ -340,7 +340,7 @@ export type { useMapType };
|
|
|
340
340
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
341
341
|
Code coverage generated by
|
|
342
342
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
343
|
-
at
|
|
343
|
+
at Tue Aug 30 2022 13:27:18 GMT+0000 (Coordinated Universal Time)
|
|
344
344
|
</div>
|
|
345
345
|
<script src="../../prettify.js"></script>
|
|
346
346
|
<script>
|
|
@@ -637,7 +637,7 @@ export default useMapState;
|
|
|
637
637
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
638
638
|
Code coverage generated by
|
|
639
639
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
640
|
-
at
|
|
640
|
+
at Tue Aug 30 2022 13:27:18 GMT+0000 (Coordinated Universal Time)
|
|
641
641
|
</div>
|
|
642
642
|
<script src="../../prettify.js"></script>
|
|
643
643
|
<script>
|
|
@@ -343,7 +343,7 @@ export default useWms;
|
|
|
343
343
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
344
344
|
Code coverage generated by
|
|
345
345
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
346
|
-
at
|
|
346
|
+
at Tue Aug 30 2022 13:27:18 GMT+0000 (Coordinated Universal Time)
|
|
347
347
|
</div>
|
|
348
348
|
<script src="../../prettify.js"></script>
|
|
349
349
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at
|
|
104
|
+
at Tue Aug 30 2022 13:27:18 GMT+0000 (Coordinated Universal Time)
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -102,7 +102,9 @@
|
|
|
102
102
|
<a name='L37'></a><a href='#L37'>37</a>
|
|
103
103
|
<a name='L38'></a><a href='#L38'>38</a>
|
|
104
104
|
<a name='L39'></a><a href='#L39'>39</a>
|
|
105
|
-
<a name='L40'></a><a href='#L40'>40</a
|
|
105
|
+
<a name='L40'></a><a href='#L40'>40</a>
|
|
106
|
+
<a name='L41'></a><a href='#L41'>41</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
107
|
+
<span class="cline-any cline-neutral"> </span>
|
|
106
108
|
<span class="cline-any cline-neutral"> </span>
|
|
107
109
|
<span class="cline-any cline-neutral"> </span>
|
|
108
110
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -155,6 +157,7 @@ export { default as MlNavigationCompass } from "./components/MlNavigationCompass
|
|
|
155
157
|
export { default as MlLayer } from "./components/MlLayer/MlLayer";
|
|
156
158
|
export { default as MlVectorTileLayer } from "./components/MlVectorTileLayer/MlVectorTileLayer";
|
|
157
159
|
export { default as MlWmsLayer } from "./components/MlWmsLayer/MlWmsLayer";
|
|
160
|
+
export { default as MlScaleReference } from "./components/MlScaleReference/MlScaleReference";
|
|
158
161
|
|
|
159
162
|
export { default as MlLayerMagnify } from "./components/MlLayerMagnify/MlLayerMagnify";
|
|
160
163
|
export { default as MlLayerSwipe } from "./components/MlLayerSwipe/MlLayerSwipe";
|
|
@@ -187,7 +190,7 @@ export { default as SimpleDataContext } from "./contexts/SimpleDataContext";
|
|
|
187
190
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
188
191
|
Code coverage generated by
|
|
189
192
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
190
|
-
at
|
|
193
|
+
at Tue Aug 30 2022 13:27:18 GMT+0000 (Coordinated Universal Time)
|
|
191
194
|
</div>
|
|
192
195
|
<script src="../prettify.js"></script>
|
|
193
196
|
<script>
|
package/coverage/lcov.info
CHANGED
|
@@ -2045,7 +2045,7 @@ FNDA:0,(anonymous_3)
|
|
|
2045
2045
|
FNDA:0,(anonymous_4)
|
|
2046
2046
|
FNDA:0,(anonymous_5)
|
|
2047
2047
|
FNDA:0,(anonymous_6)
|
|
2048
|
-
DA:4,
|
|
2048
|
+
DA:4,10
|
|
2049
2049
|
DA:5,0
|
|
2050
2050
|
DA:6,0
|
|
2051
2051
|
DA:8,0
|
|
@@ -2094,7 +2094,7 @@ DA:77,0
|
|
|
2094
2094
|
DA:79,0
|
|
2095
2095
|
DA:82,0
|
|
2096
2096
|
LF:48
|
|
2097
|
-
LH:
|
|
2097
|
+
LH:1
|
|
2098
2098
|
BRDA:12,0,0,0
|
|
2099
2099
|
BRDA:12,0,1,0
|
|
2100
2100
|
BRDA:15,1,0,0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function ThemeWrapper(props: any): JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export { default as MlNavigationCompass } from "./components/MlNavigationCompass
|
|
|
12
12
|
export { default as MlLayer } from "./components/MlLayer/MlLayer";
|
|
13
13
|
export { default as MlVectorTileLayer } from "./components/MlVectorTileLayer/MlVectorTileLayer";
|
|
14
14
|
export { default as MlWmsLayer } from "./components/MlWmsLayer/MlWmsLayer";
|
|
15
|
+
export { default as MlScaleReference } from "./components/MlScaleReference/MlScaleReference";
|
|
15
16
|
export { default as MlLayerMagnify } from "./components/MlLayerMagnify/MlLayerMagnify";
|
|
16
17
|
export { default as MlLayerSwipe } from "./components/MlLayerSwipe/MlLayerSwipe";
|
|
17
18
|
export { default as MlTransitionGeoJsonLayer } from "./components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer";
|
package/dist/index.esm.js
CHANGED
|
@@ -13814,6 +13814,235 @@ MlWmsLayer.propTypes = {
|
|
|
13814
13814
|
visible: PropTypes.bool,
|
|
13815
13815
|
};
|
|
13816
13816
|
|
|
13817
|
+
function ownKeys(object, enumerableOnly) {
|
|
13818
|
+
var keys = Object.keys(object);
|
|
13819
|
+
|
|
13820
|
+
if (Object.getOwnPropertySymbols) {
|
|
13821
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
13822
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
13823
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
13824
|
+
})), keys.push.apply(keys, symbols);
|
|
13825
|
+
}
|
|
13826
|
+
|
|
13827
|
+
return keys;
|
|
13828
|
+
}
|
|
13829
|
+
|
|
13830
|
+
function _objectSpread2(target) {
|
|
13831
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
13832
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
13833
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
13834
|
+
_defineProperty(target, key, source[key]);
|
|
13835
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
13836
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
13837
|
+
});
|
|
13838
|
+
}
|
|
13839
|
+
|
|
13840
|
+
return target;
|
|
13841
|
+
}
|
|
13842
|
+
|
|
13843
|
+
function _typeof(obj) {
|
|
13844
|
+
"@babel/helpers - typeof";
|
|
13845
|
+
|
|
13846
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
13847
|
+
return typeof obj;
|
|
13848
|
+
} : function (obj) {
|
|
13849
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
13850
|
+
}, _typeof(obj);
|
|
13851
|
+
}
|
|
13852
|
+
|
|
13853
|
+
function _defineProperty(obj, key, value) {
|
|
13854
|
+
if (key in obj) {
|
|
13855
|
+
Object.defineProperty(obj, key, {
|
|
13856
|
+
value: value,
|
|
13857
|
+
enumerable: true,
|
|
13858
|
+
configurable: true,
|
|
13859
|
+
writable: true
|
|
13860
|
+
});
|
|
13861
|
+
} else {
|
|
13862
|
+
obj[key] = value;
|
|
13863
|
+
}
|
|
13864
|
+
|
|
13865
|
+
return obj;
|
|
13866
|
+
}
|
|
13867
|
+
|
|
13868
|
+
function _slicedToArray(arr, i) {
|
|
13869
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
13870
|
+
}
|
|
13871
|
+
|
|
13872
|
+
function _toConsumableArray(arr) {
|
|
13873
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
13874
|
+
}
|
|
13875
|
+
|
|
13876
|
+
function _arrayWithoutHoles(arr) {
|
|
13877
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
13878
|
+
}
|
|
13879
|
+
|
|
13880
|
+
function _arrayWithHoles(arr) {
|
|
13881
|
+
if (Array.isArray(arr)) return arr;
|
|
13882
|
+
}
|
|
13883
|
+
|
|
13884
|
+
function _iterableToArray(iter) {
|
|
13885
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
13886
|
+
}
|
|
13887
|
+
|
|
13888
|
+
function _iterableToArrayLimit(arr, i) {
|
|
13889
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
13890
|
+
|
|
13891
|
+
if (_i == null) return;
|
|
13892
|
+
var _arr = [];
|
|
13893
|
+
var _n = true;
|
|
13894
|
+
var _d = false;
|
|
13895
|
+
|
|
13896
|
+
var _s, _e;
|
|
13897
|
+
|
|
13898
|
+
try {
|
|
13899
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
13900
|
+
_arr.push(_s.value);
|
|
13901
|
+
|
|
13902
|
+
if (i && _arr.length === i) break;
|
|
13903
|
+
}
|
|
13904
|
+
} catch (err) {
|
|
13905
|
+
_d = true;
|
|
13906
|
+
_e = err;
|
|
13907
|
+
} finally {
|
|
13908
|
+
try {
|
|
13909
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
13910
|
+
} finally {
|
|
13911
|
+
if (_d) throw _e;
|
|
13912
|
+
}
|
|
13913
|
+
}
|
|
13914
|
+
|
|
13915
|
+
return _arr;
|
|
13916
|
+
}
|
|
13917
|
+
|
|
13918
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
13919
|
+
if (!o) return;
|
|
13920
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
13921
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
13922
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
13923
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
13924
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
13925
|
+
}
|
|
13926
|
+
|
|
13927
|
+
function _arrayLikeToArray(arr, len) {
|
|
13928
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
13929
|
+
|
|
13930
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
13931
|
+
|
|
13932
|
+
return arr2;
|
|
13933
|
+
}
|
|
13934
|
+
|
|
13935
|
+
function _nonIterableSpread() {
|
|
13936
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
13937
|
+
}
|
|
13938
|
+
|
|
13939
|
+
function _nonIterableRest() {
|
|
13940
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
13941
|
+
}
|
|
13942
|
+
|
|
13943
|
+
var MlScaleReference = function MlScaleReference(props) {
|
|
13944
|
+
var zoomRef = useRef(0);
|
|
13945
|
+
var mapHook = useMap({
|
|
13946
|
+
mapId: props.mapId,
|
|
13947
|
+
waitForLayer: props.insertBeforeLayer
|
|
13948
|
+
});
|
|
13949
|
+
|
|
13950
|
+
var _useState = useState(0),
|
|
13951
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13952
|
+
pxWidth = _useState2[0],
|
|
13953
|
+
setPxWidth = _useState2[1];
|
|
13954
|
+
|
|
13955
|
+
var _useState3 = useState(""),
|
|
13956
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
13957
|
+
text = _useState4[0],
|
|
13958
|
+
setText = _useState4[1];
|
|
13959
|
+
|
|
13960
|
+
var updateScale = useCallback(function () {
|
|
13961
|
+
var _mapHook$map, _mapHook$map2;
|
|
13962
|
+
|
|
13963
|
+
if (((_mapHook$map = mapHook.map) === null || _mapHook$map === void 0 ? void 0 : _mapHook$map.map.getZoom()) === zoomRef.current) {
|
|
13964
|
+
return;
|
|
13965
|
+
}
|
|
13966
|
+
|
|
13967
|
+
if (!mapHook.map) return;
|
|
13968
|
+
zoomRef.current = (_mapHook$map2 = mapHook.map) === null || _mapHook$map2 === void 0 ? void 0 : _mapHook$map2.map.getZoom(); // Calculation from MapLibre
|
|
13969
|
+
// A horizontal scale is imagined to be present at center of the map
|
|
13970
|
+
// Using spherical law of cosines approximation, the real distance is
|
|
13971
|
+
// found between the two coordinates.
|
|
13972
|
+
|
|
13973
|
+
var maxWidth = props.maxWidth || 100;
|
|
13974
|
+
var y = mapHook.map._container.clientHeight / 2;
|
|
13975
|
+
var left = mapHook.map.unproject([0, y]);
|
|
13976
|
+
var right = mapHook.map.unproject([maxWidth, y]);
|
|
13977
|
+
var maxMeters = left.distanceTo(right); // The real distance corresponding to 100px scale length is rounded off to
|
|
13978
|
+
// near pretty number and the scale length for the same is found out.
|
|
13979
|
+
// Default unit of the scale is based on User's locale.
|
|
13980
|
+
|
|
13981
|
+
if (props.unit === "imperial") {
|
|
13982
|
+
var maxFeet = 3.2808 * maxMeters;
|
|
13983
|
+
|
|
13984
|
+
if (maxFeet > 5280) {
|
|
13985
|
+
var maxMiles = maxFeet / 5280;
|
|
13986
|
+
setScale(maxWidth, maxMiles, mapHook.map._getUIString("ScaleControl.Miles"));
|
|
13987
|
+
} else {
|
|
13988
|
+
setScale(maxWidth, maxFeet, mapHook.map._getUIString("ScaleControl.Feet"));
|
|
13989
|
+
}
|
|
13990
|
+
} else if (props.unit === "nautical") {
|
|
13991
|
+
var maxNauticals = maxMeters / 1852;
|
|
13992
|
+
setScale(maxWidth, maxNauticals, mapHook.map._getUIString("ScaleControl.NauticalMiles"));
|
|
13993
|
+
} else if (maxMeters >= 1000) {
|
|
13994
|
+
setScale(maxWidth, maxMeters / 1000, mapHook.map._getUIString("ScaleControl.Kilometers"));
|
|
13995
|
+
} else {
|
|
13996
|
+
setScale(maxWidth, maxMeters, mapHook.map._getUIString("ScaleControl.Meters"));
|
|
13997
|
+
}
|
|
13998
|
+
}, [mapHook.map, props.unit, props.maxWidth]);
|
|
13999
|
+
useEffect(function () {
|
|
14000
|
+
if (!mapHook.map) return;
|
|
14001
|
+
var _updateScale = updateScale;
|
|
14002
|
+
mapHook.map.on("move", _updateScale, mapHook.componentId);
|
|
14003
|
+
updateScale();
|
|
14004
|
+
return function () {
|
|
14005
|
+
mapHook.map.off("move", _updateScale);
|
|
14006
|
+
};
|
|
14007
|
+
}, [mapHook.map, updateScale]);
|
|
14008
|
+
|
|
14009
|
+
var setScale = function setScale(maxWidth, maxDistance, unit) {
|
|
14010
|
+
var distance = getRoundNum(maxDistance);
|
|
14011
|
+
var ratio = distance / maxDistance;
|
|
14012
|
+
setPxWidth(maxWidth * ratio);
|
|
14013
|
+
setText(distance + " " + unit);
|
|
14014
|
+
};
|
|
14015
|
+
|
|
14016
|
+
var getDecimalRoundNum = function getDecimalRoundNum(d) {
|
|
14017
|
+
var multiplier = Math.pow(10, Math.ceil(-Math.log(d) / Math.LN10));
|
|
14018
|
+
return Math.round(d * multiplier) / multiplier;
|
|
14019
|
+
};
|
|
14020
|
+
|
|
14021
|
+
var getRoundNum = function getRoundNum(num) {
|
|
14022
|
+
var pow10 = Math.pow(10, "".concat(Math.floor(num)).length - 1);
|
|
14023
|
+
var d = num / pow10;
|
|
14024
|
+
d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : d >= 1 ? 1 : getDecimalRoundNum(d);
|
|
14025
|
+
return pow10 * d;
|
|
14026
|
+
};
|
|
14027
|
+
|
|
14028
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
14029
|
+
style: {
|
|
14030
|
+
backgroundColor: "hsla(0,0%,100%,.75)",
|
|
14031
|
+
fontSize: "10px",
|
|
14032
|
+
border: "2px solid #333",
|
|
14033
|
+
borderTop: "#333",
|
|
14034
|
+
padding: "0 5px",
|
|
14035
|
+
color: "#333",
|
|
14036
|
+
boxSizing: "border-box",
|
|
14037
|
+
width: pxWidth + "px",
|
|
14038
|
+
fontFamily: "sans-serif"
|
|
14039
|
+
},
|
|
14040
|
+
dangerouslySetInnerHTML: {
|
|
14041
|
+
__html: text
|
|
14042
|
+
}
|
|
14043
|
+
}));
|
|
14044
|
+
};
|
|
14045
|
+
|
|
13817
14046
|
/**
|
|
13818
14047
|
*
|
|
13819
14048
|
* Hides the MapLibreMap referenced by props.map2Id except for the "magnifier"-circle that reveals
|
|
@@ -14063,132 +14292,6 @@ var MlLayerSwipe = function (props) {
|
|
|
14063
14292
|
}, onTouchStart: onDown, onMouseDown: onDown }));
|
|
14064
14293
|
};
|
|
14065
14294
|
|
|
14066
|
-
function ownKeys(object, enumerableOnly) {
|
|
14067
|
-
var keys = Object.keys(object);
|
|
14068
|
-
|
|
14069
|
-
if (Object.getOwnPropertySymbols) {
|
|
14070
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
14071
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
14072
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
14073
|
-
})), keys.push.apply(keys, symbols);
|
|
14074
|
-
}
|
|
14075
|
-
|
|
14076
|
-
return keys;
|
|
14077
|
-
}
|
|
14078
|
-
|
|
14079
|
-
function _objectSpread2(target) {
|
|
14080
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
14081
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
14082
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
14083
|
-
_defineProperty(target, key, source[key]);
|
|
14084
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
14085
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
14086
|
-
});
|
|
14087
|
-
}
|
|
14088
|
-
|
|
14089
|
-
return target;
|
|
14090
|
-
}
|
|
14091
|
-
|
|
14092
|
-
function _typeof(obj) {
|
|
14093
|
-
"@babel/helpers - typeof";
|
|
14094
|
-
|
|
14095
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
14096
|
-
return typeof obj;
|
|
14097
|
-
} : function (obj) {
|
|
14098
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
14099
|
-
}, _typeof(obj);
|
|
14100
|
-
}
|
|
14101
|
-
|
|
14102
|
-
function _defineProperty(obj, key, value) {
|
|
14103
|
-
if (key in obj) {
|
|
14104
|
-
Object.defineProperty(obj, key, {
|
|
14105
|
-
value: value,
|
|
14106
|
-
enumerable: true,
|
|
14107
|
-
configurable: true,
|
|
14108
|
-
writable: true
|
|
14109
|
-
});
|
|
14110
|
-
} else {
|
|
14111
|
-
obj[key] = value;
|
|
14112
|
-
}
|
|
14113
|
-
|
|
14114
|
-
return obj;
|
|
14115
|
-
}
|
|
14116
|
-
|
|
14117
|
-
function _slicedToArray(arr, i) {
|
|
14118
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
14119
|
-
}
|
|
14120
|
-
|
|
14121
|
-
function _toConsumableArray(arr) {
|
|
14122
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
14123
|
-
}
|
|
14124
|
-
|
|
14125
|
-
function _arrayWithoutHoles(arr) {
|
|
14126
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
14127
|
-
}
|
|
14128
|
-
|
|
14129
|
-
function _arrayWithHoles(arr) {
|
|
14130
|
-
if (Array.isArray(arr)) return arr;
|
|
14131
|
-
}
|
|
14132
|
-
|
|
14133
|
-
function _iterableToArray(iter) {
|
|
14134
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
14135
|
-
}
|
|
14136
|
-
|
|
14137
|
-
function _iterableToArrayLimit(arr, i) {
|
|
14138
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
14139
|
-
|
|
14140
|
-
if (_i == null) return;
|
|
14141
|
-
var _arr = [];
|
|
14142
|
-
var _n = true;
|
|
14143
|
-
var _d = false;
|
|
14144
|
-
|
|
14145
|
-
var _s, _e;
|
|
14146
|
-
|
|
14147
|
-
try {
|
|
14148
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
14149
|
-
_arr.push(_s.value);
|
|
14150
|
-
|
|
14151
|
-
if (i && _arr.length === i) break;
|
|
14152
|
-
}
|
|
14153
|
-
} catch (err) {
|
|
14154
|
-
_d = true;
|
|
14155
|
-
_e = err;
|
|
14156
|
-
} finally {
|
|
14157
|
-
try {
|
|
14158
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
14159
|
-
} finally {
|
|
14160
|
-
if (_d) throw _e;
|
|
14161
|
-
}
|
|
14162
|
-
}
|
|
14163
|
-
|
|
14164
|
-
return _arr;
|
|
14165
|
-
}
|
|
14166
|
-
|
|
14167
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
14168
|
-
if (!o) return;
|
|
14169
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
14170
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
14171
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
14172
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
14173
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
14174
|
-
}
|
|
14175
|
-
|
|
14176
|
-
function _arrayLikeToArray(arr, len) {
|
|
14177
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
14178
|
-
|
|
14179
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
14180
|
-
|
|
14181
|
-
return arr2;
|
|
14182
|
-
}
|
|
14183
|
-
|
|
14184
|
-
function _nonIterableSpread() {
|
|
14185
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14186
|
-
}
|
|
14187
|
-
|
|
14188
|
-
function _nonIterableRest() {
|
|
14189
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14190
|
-
}
|
|
14191
|
-
|
|
14192
14295
|
var _showNextTransitionSegment = function _showNextTransitionSegment(props, map, transitionInProgressRef, transitionGeojsonDataRef, transitionGeojsonCommonDataRef, currentTransitionStepRef, msPerStep, transitionTimeoutRef, setDisplayGeojson) {
|
|
14193
14296
|
var _arguments = arguments;
|
|
14194
14297
|
|
|
@@ -18902,5 +19005,5 @@ SimpleDataProvider.propTypes = {
|
|
|
18902
19005
|
children: PropTypes.node.isRequired
|
|
18903
19006
|
};
|
|
18904
19007
|
|
|
18905
|
-
export { GeoJsonContext, GeoJsonProvider, MapComponentsProvider, MapContext, MapLibreMap, MlBasicComponent, MlComponentTemplate, MlCreatePdfButton, MlFeatureEditor, MlFillExtrusionLayer, MlFollowGps, MlGPXViewer, MlGeoJsonLayer, MlImageMarkerLayer, MlLayer, MlLayerMagnify, MlLayerSwipe, MlMarker, MlMeasureTool, MlNavigationCompass, MlNavigationTools, MlOsmLayer, MlSpatialElevationProfile, MlTransitionGeoJsonLayer, MlVectorTileLayer, MlWmsLayer, SimpleDataContext, SimpleDataProvider, useLayer, useMap, useMapState, useWms };
|
|
19008
|
+
export { GeoJsonContext, GeoJsonProvider, MapComponentsProvider, MapContext, MapLibreMap, MlBasicComponent, MlComponentTemplate, MlCreatePdfButton, MlFeatureEditor, MlFillExtrusionLayer, MlFollowGps, MlGPXViewer, MlGeoJsonLayer, MlImageMarkerLayer, MlLayer, MlLayerMagnify, MlLayerSwipe, MlMarker, MlMeasureTool, MlNavigationCompass, MlNavigationTools, MlOsmLayer, MlScaleReference, MlSpatialElevationProfile, MlTransitionGeoJsonLayer, MlVectorTileLayer, MlWmsLayer, SimpleDataContext, SimpleDataProvider, useLayer, useMap, useMapState, useWms };
|
|
18906
19009
|
//# sourceMappingURL=index.esm.js.map
|