react-native-maplibre-lite 0.1.2 → 0.1.4

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.
Files changed (73) hide show
  1. package/README.md +133 -45
  2. package/lib/module/components/MapView.js +55 -20
  3. package/lib/module/components/MapView.js.map +1 -1
  4. package/lib/module/components/webMapBuild.js +4 -0
  5. package/lib/module/components/webMapBuild.js.map +1 -0
  6. package/lib/typescript/src/components/MapView.d.ts +28 -2
  7. package/lib/typescript/src/components/MapView.d.ts.map +1 -1
  8. package/lib/typescript/src/components/types.d.ts +30 -5
  9. package/lib/typescript/src/components/types.d.ts.map +1 -1
  10. package/lib/typescript/src/components/webMapBuild.d.ts +2 -0
  11. package/lib/typescript/src/components/webMapBuild.d.ts.map +1 -0
  12. package/lib/typescript/src/index.d.ts +1 -1
  13. package/lib/typescript/src/index.d.ts.map +1 -1
  14. package/package.json +3 -2
  15. package/src/components/MapView.tsx +72 -33
  16. package/src/components/types.ts +37 -6
  17. package/src/components/webMapBuild.ts +4 -0
  18. package/src/index.tsx +13 -1
  19. package/lib/module/components/webContent.js +0 -159
  20. package/lib/module/components/webContent.js.map +0 -1
  21. package/lib/module/components/webFunctions/addMarkerWeb.js +0 -83
  22. package/lib/module/components/webFunctions/addMarkerWeb.js.map +0 -1
  23. package/lib/module/components/webFunctions/addPolygonWeb.js +0 -62
  24. package/lib/module/components/webFunctions/addPolygonWeb.js.map +0 -1
  25. package/lib/module/components/webFunctions/addPolylineWeb.js +0 -48
  26. package/lib/module/components/webFunctions/addPolylineWeb.js.map +0 -1
  27. package/lib/module/components/webFunctions/fitBoundsWeb.js +0 -15
  28. package/lib/module/components/webFunctions/fitBoundsWeb.js.map +0 -1
  29. package/lib/module/components/webFunctions/flyToWeb.js +0 -14
  30. package/lib/module/components/webFunctions/flyToWeb.js.map +0 -1
  31. package/lib/module/components/webFunctions/initWeb.js +0 -158
  32. package/lib/module/components/webFunctions/initWeb.js.map +0 -1
  33. package/lib/module/components/webFunctions/removeMarkerWeb.js +0 -12
  34. package/lib/module/components/webFunctions/removeMarkerWeb.js.map +0 -1
  35. package/lib/module/components/webFunctions/removePolygonWeb.js +0 -22
  36. package/lib/module/components/webFunctions/removePolygonWeb.js.map +0 -1
  37. package/lib/module/components/webFunctions/removePolylineWeb.js +0 -17
  38. package/lib/module/components/webFunctions/removePolylineWeb.js.map +0 -1
  39. package/lib/module/components/webFunctions/updateWeb.js +0 -78
  40. package/lib/module/components/webFunctions/updateWeb.js.map +0 -1
  41. package/lib/typescript/src/components/webContent.d.ts +0 -3
  42. package/lib/typescript/src/components/webContent.d.ts.map +0 -1
  43. package/lib/typescript/src/components/webFunctions/addMarkerWeb.d.ts +0 -3
  44. package/lib/typescript/src/components/webFunctions/addMarkerWeb.d.ts.map +0 -1
  45. package/lib/typescript/src/components/webFunctions/addPolygonWeb.d.ts +0 -3
  46. package/lib/typescript/src/components/webFunctions/addPolygonWeb.d.ts.map +0 -1
  47. package/lib/typescript/src/components/webFunctions/addPolylineWeb.d.ts +0 -3
  48. package/lib/typescript/src/components/webFunctions/addPolylineWeb.d.ts.map +0 -1
  49. package/lib/typescript/src/components/webFunctions/fitBoundsWeb.d.ts +0 -3
  50. package/lib/typescript/src/components/webFunctions/fitBoundsWeb.d.ts.map +0 -1
  51. package/lib/typescript/src/components/webFunctions/flyToWeb.d.ts +0 -2
  52. package/lib/typescript/src/components/webFunctions/flyToWeb.d.ts.map +0 -1
  53. package/lib/typescript/src/components/webFunctions/initWeb.d.ts +0 -3
  54. package/lib/typescript/src/components/webFunctions/initWeb.d.ts.map +0 -1
  55. package/lib/typescript/src/components/webFunctions/removeMarkerWeb.d.ts +0 -3
  56. package/lib/typescript/src/components/webFunctions/removeMarkerWeb.d.ts.map +0 -1
  57. package/lib/typescript/src/components/webFunctions/removePolygonWeb.d.ts +0 -3
  58. package/lib/typescript/src/components/webFunctions/removePolygonWeb.d.ts.map +0 -1
  59. package/lib/typescript/src/components/webFunctions/removePolylineWeb.d.ts +0 -3
  60. package/lib/typescript/src/components/webFunctions/removePolylineWeb.d.ts.map +0 -1
  61. package/lib/typescript/src/components/webFunctions/updateWeb.d.ts +0 -3
  62. package/lib/typescript/src/components/webFunctions/updateWeb.d.ts.map +0 -1
  63. package/src/components/webContent.ts +0 -163
  64. package/src/components/webFunctions/addMarkerWeb.ts +0 -80
  65. package/src/components/webFunctions/addPolygonWeb.ts +0 -59
  66. package/src/components/webFunctions/addPolylineWeb.ts +0 -45
  67. package/src/components/webFunctions/fitBoundsWeb.ts +0 -12
  68. package/src/components/webFunctions/flyToWeb.ts +0 -11
  69. package/src/components/webFunctions/initWeb.ts +0 -155
  70. package/src/components/webFunctions/removeMarkerWeb.ts +0 -9
  71. package/src/components/webFunctions/removePolygonWeb.ts +0 -19
  72. package/src/components/webFunctions/removePolylineWeb.ts +0 -14
  73. package/src/components/webFunctions/updateWeb.ts +0 -75
package/src/index.tsx CHANGED
@@ -7,4 +7,16 @@ export { MapView, Marker, Polygon, Polyline };
7
7
  export default MapView;
8
8
 
9
9
  export type { MapViewRef } from './components/MapView';
10
- export type { MarkerProps, PolygonProps, PolylineProps, EventParams, SourcesProps } from './components/types';
10
+ export type {
11
+ EventParams,
12
+ MapLiteWebError,
13
+ MarkerProps,
14
+ NavigatorInstructionParams,
15
+ NavigatorLang,
16
+ NavigatorLngLat,
17
+ NavigatorPositionMode,
18
+ NavigatorPositionSetParams,
19
+ NavigatorRouteSetParams,
20
+ PolygonProps,
21
+ PolylineProps,
22
+ } from './components/types';
@@ -1,159 +0,0 @@
1
- "use strict";
2
-
3
- import { loadResources } from "./utils.js";
4
- export const maplibreHtmlMap = async (webFunctions, sources, debugMode) => {
5
- //Загружаем скрипты как текст
6
-
7
- let maplibreJS = await loadResources(sources.maplibreJS);
8
- let maplibreCSS = await loadResources(sources.maplibreCSS);
9
- let pmtiles = await loadResources(sources.pmtilesJS);
10
- console.log('MapLibre: maplibreJS', !!maplibreJS ? 'true' : 'false');
11
- console.log('MapLibre: maplibreCSS', !!maplibreCSS ? 'true' : 'false');
12
- console.log('MapLibre: pmtiles', !!pmtiles ? 'true' : 'false');
13
- return `<!DOCTYPE html>
14
- <html lang="">
15
-
16
- <head>
17
- <meta charset="utf-8" />
18
- <meta name="viewport" content="width=device-width, initial-scale=1" />
19
- <title></title>
20
-
21
-
22
- <script>${maplibreJS}</script>
23
-
24
- <style>${maplibreCSS}</style>
25
-
26
-
27
- <script>${pmtiles}</script>
28
-
29
- <style>
30
-
31
-
32
- html,
33
- body {
34
-
35
- overflow: hidden;
36
- height: 100vh;
37
- width: 100vw;
38
- margin: 0;
39
- padding: 0;
40
-
41
- }
42
-
43
-
44
-
45
- * {
46
- -webkit-user-select: none;
47
- -khtml-user-select: none;
48
- -moz-user-select: none;
49
- -ms-user-select: none;
50
- user-select: none;
51
- }
52
-
53
-
54
- * {
55
- -webkit-touch-callout: none;
56
- -moz-touch-callout: none;
57
- -ms-touch-callout: none;
58
- touch-callout: none;
59
- }
60
-
61
- * {
62
- -webkit-user-drag: none;
63
- -moz-user-drag: none;
64
- -ms-user-drag: none;
65
- user-drag: none;
66
- }
67
-
68
- .maplibregl-ctrl-bottom-right {
69
- display: none;
70
- }
71
-
72
-
73
- #map {
74
-
75
-
76
- height: 100vh;
77
- width: 100vw;
78
- }
79
- </style>
80
-
81
- </head>
82
-
83
- <body>
84
- <div id="map"></div>
85
- </body>
86
-
87
- <script>
88
-
89
- var markers = {};
90
- var polylines = {};
91
- var polygons = {};
92
- var rectangles = {};
93
- var layouts = {};
94
-
95
- var map = null;
96
-
97
- try {
98
- var protocol = new pmtiles.Protocol();
99
- maplibregl.addProtocol("pmtiles", protocol.tile);
100
-
101
- window.onload = function () {
102
- document.addEventListener("message", function (event) {
103
- receiveMessage(event.data);
104
- });
105
- window.addEventListener("message", function (event) {
106
- receiveMessage(event.data);
107
- });
108
- if (window.ReactNativeWebView) {
109
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'scriptReady' }));
110
- }
111
- }
112
-
113
-
114
- function receiveMessage(message) {
115
-
116
- var data = JSON.parse(message);
117
-
118
- var functionName = data.function;
119
- var params = data.params;
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
- try{
128
-
129
- ${webFunctions}
130
-
131
- } catch (e) {
132
- if(${debugMode}){
133
- alert('WebView function error: ' + functionName + ' ' + e.message);
134
- }
135
- console.error('WebView function error:', functionName, e.message);
136
- window.ReactNativeWebView.postMessage(JSON.stringify({
137
- type: 'error',
138
- data: {
139
- target: functionName,
140
- message: String(e.message),
141
- }
142
- }));
143
- }
144
- };
145
-
146
- } catch (e) {
147
-
148
- if(${debugMode}){
149
- alert('pmtiles init error: ' + e.message);
150
- }
151
-
152
-
153
- }
154
- </script>
155
-
156
-
157
- </html>`;
158
- };
159
- //# sourceMappingURL=webContent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["loadResources","maplibreHtmlMap","webFunctions","sources","debugMode","maplibreJS","maplibreCSS","pmtiles","pmtilesJS","console","log"],"sourceRoot":"../../../src","sources":["components/webContent.ts"],"mappings":";;AACA,SAAQA,aAAa,QAAO,YAAS;AAErC,OAAO,MAAMC,eAAe,GAAG,MAAAA,CAAOC,YAAoB,EAAEC,OAAqB,EAAEC,SAAkB,KAAK;EACtG;;EAGA,IAAIC,UAAU,GAAG,MAAML,aAAa,CAACG,OAAO,CAACE,UAAU,CAAC;EACxD,IAAIC,WAAW,GAAG,MAAMN,aAAa,CAACG,OAAO,CAACG,WAAW,CAAC;EAC1D,IAAIC,OAAO,GAAG,MAAMP,aAAa,CAACG,OAAO,CAACK,SAAS,CAAC;EAEpDC,OAAO,CAACC,GAAG,CAAC,sBAAsB,EAAE,CAAC,CAACL,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;EACpEI,OAAO,CAACC,GAAG,CAAC,uBAAuB,EAAE,CAAC,CAACJ,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;EACtEG,OAAO,CAACC,GAAG,CAAC,mBAAmB,EAAE,CAAC,CAACH,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;EAI9D,OAAO;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcF,UAAU;AACxB;AACA,aAAaC,WAAW;AACxB;AACA;AACA,cAAcC,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAEL,YAAY;AACd;AACA;AACA,SAASE,SAAS;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR,CAAC","ignoreList":[]}
@@ -1,83 +0,0 @@
1
- "use strict";
2
-
3
- export default /*js*/`
4
-
5
- if(functionName === 'addMarker') {
6
-
7
-
8
- if(markers[params.uniqueId]){
9
- markers[params.uniqueId].remove();
10
- delete markers[params.uniqueId];
11
- }
12
-
13
-
14
- if(params && params.html){
15
-
16
- var el = document.createElement('div');
17
- el.className = 'marker';
18
- el.innerHTML = params.html;
19
-
20
- el.addEventListener('click', function() {
21
- window.ReactNativeWebView.postMessage(JSON.stringify({
22
- type: 'markerClick',
23
- uniqueId: params.uniqueId
24
- }));
25
- });
26
-
27
-
28
- markers[params.uniqueId] = new maplibregl.Marker({element: el})
29
- .setLngLat([params.longitude, params.latitude])
30
- .addTo(map);
31
-
32
- return;
33
-
34
- }
35
-
36
-
37
- if(!params || !params.iconUrl){
38
-
39
-
40
- markers[params.uniqueId] = new maplibregl.Marker({
41
- color: (params.color != null) ? params.color : undefined,
42
- }).setLngLat([params.longitude, params.latitude])
43
- .addTo(map);
44
- markers[params.uniqueId].getElement().addEventListener('click', function() {
45
- window.ReactNativeWebView.postMessage(JSON.stringify({
46
- type: 'markerClick',
47
- uniqueId: params.uniqueId
48
- }));
49
- });
50
-
51
- return;
52
-
53
- }else{
54
-
55
-
56
- var el2 = document.createElement('div');
57
- el2.className = 'marker';
58
- el2.style.backgroundImage = 'url(' + params.iconUrl + ')';
59
- el2.style.backgroundSize = 'cover';
60
- el2.style.backgroundPosition = 'center';
61
- el2.style.backgroundRepeat = 'no-repeat';
62
- el2.style.width = params.iconWidth + 'px';
63
- el2.style.height = params.iconHeight + 'px';
64
-
65
- el2.addEventListener('click', function() {
66
- window.ReactNativeWebView.postMessage(JSON.stringify({
67
- type: 'markerClick',
68
- uniqueId: params.uniqueId
69
- }));
70
- });
71
-
72
-
73
- markers[params.uniqueId] = new maplibregl.Marker({element: el2})
74
- .setLngLat([params.longitude, params.latitude])
75
- .addTo(map);
76
-
77
- return;
78
-
79
- }
80
- }
81
-
82
- `;
83
- //# sourceMappingURL=addMarkerWeb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/webFunctions/addMarkerWeb.ts"],"mappings":";;AAAA,eAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa","ignoreList":[]}
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- export default /*js*/`
4
-
5
- if(functionName === 'addPolygon') {
6
-
7
- var sourceId = params.uniqueId + '-polygons-source';
8
- var fillLayerId = params.uniqueId + '-polygons-fill';
9
- var strokeLayerId = params.uniqueId + '-polygons-stroke';
10
-
11
- if(map.getLayer(strokeLayerId)) {
12
- map.removeLayer(strokeLayerId);
13
- }
14
- if(map.getLayer(fillLayerId)) {
15
- map.removeLayer(fillLayerId);
16
- }
17
- if(map.getSource(sourceId)) {
18
- map.removeSource(sourceId);
19
- }
20
-
21
- map.addSource(sourceId, {
22
- 'type': 'geojson',
23
- 'data': {
24
- 'type': 'Feature',
25
- 'geometry': {
26
- 'type': 'Polygon',
27
- 'coordinates': [params.coordinates]
28
- }
29
- }
30
- });
31
-
32
- var fillPaint = {};
33
- fillPaint['fill-color'] = params.fillColor || 'rgba(0,0,0,0)';
34
- if(params.fillOpacity != null) fillPaint['fill-opacity'] = params.fillOpacity;
35
- if(params.strokeColor) fillPaint['fill-outline-color'] = params.strokeColor;
36
-
37
- map.addLayer({
38
- 'id': fillLayerId,
39
- 'type': 'fill',
40
- 'source': sourceId,
41
- 'layout': {},
42
- 'paint': fillPaint
43
- });
44
-
45
- if(params.strokeColor || params.strokeWidth) {
46
- var linePaint = {};
47
- if(params.strokeColor) linePaint['line-color'] = params.strokeColor;
48
- if(params.strokeOpacity != null) linePaint['line-opacity'] = params.strokeOpacity;
49
- if(params.strokeWidth != null) linePaint['line-width'] = params.strokeWidth;
50
-
51
- map.addLayer({
52
- 'id': strokeLayerId,
53
- 'type': 'line',
54
- 'source': sourceId,
55
- 'layout': {},
56
- 'paint': linePaint
57
- });
58
- }
59
-
60
- }
61
- `;
62
- //# sourceMappingURL=addPolygonWeb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/webFunctions/addPolygonWeb.ts"],"mappings":";;AAAA,eAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- export default /*js*/`
4
-
5
- if(functionName === 'addPolyline') {
6
-
7
-
8
-
9
- var sourceId = params.uniqueId + '-polylines-source';
10
- var layerId = params.uniqueId + '-polylines-layout';
11
-
12
- if(map.getLayer(layerId)) {
13
- map.removeLayer(layerId);
14
- }
15
-
16
- if(map.getSource(sourceId)) {
17
- map.removeSource(sourceId);
18
- }
19
-
20
- map.addSource(sourceId, {
21
- 'type': 'geojson',
22
- 'data': {
23
- 'type': 'Feature',
24
- 'properties': {},
25
- 'geometry': {
26
- 'type': 'LineString',
27
- 'coordinates': params.coordinates
28
- }
29
- }
30
- });
31
-
32
- map.addLayer({
33
- 'id': layerId,
34
- 'type': 'line',
35
- 'source': sourceId,
36
- 'layout': {
37
- 'line-join': 'round',
38
- 'line-cap': 'round'
39
- },
40
- 'paint': {
41
- 'line-color': (params.color != null) ? params.color : '#000000',
42
- 'line-width': (params.width != null) ? params.width : 4
43
- }
44
- });
45
-
46
- }
47
- `;
48
- //# sourceMappingURL=addPolylineWeb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/webFunctions/addPolylineWeb.ts"],"mappings":";;AAAA,eAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- export default /*js*/`
4
- if(functionName === 'fitBounds') {
5
-
6
- var padding = (params && params.padding) ? params.padding : 40;
7
- var duration = (params && params.duration) ? params.duration : 500;
8
-
9
- map.fitBounds(params.bounds, {
10
- padding: padding,
11
- duration: duration
12
- });
13
- }
14
- `;
15
- //# sourceMappingURL=fitBoundsWeb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/webFunctions/fitBoundsWeb.ts"],"mappings":";;AAAA,eAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1,14 +0,0 @@
1
- "use strict";
2
-
3
- export const flyToWeb = /*js*/`
4
- if(functionName === 'flyTo') {
5
-
6
- var duration = (params && params.duration) ? params.duration : 500;
7
- map.flyTo({
8
- center: params.center,
9
- zoom: params.zoom,
10
- duration: duration
11
- });
12
- }
13
- `;
14
- //# sourceMappingURL=flyToWeb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["flyToWeb"],"sourceRoot":"../../../../src","sources":["components/webFunctions/flyToWeb.ts"],"mappings":";;AAAA,OAAO,MAAMA,QAAQ,GAAG,MAAM;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1,158 +0,0 @@
1
- "use strict";
2
-
3
- export default /*js*/`
4
-
5
- if(functionName === 'init') {
6
-
7
- function simplifyStyle(mapInstance, aggressive){
8
- if(!mapInstance) return;
9
- var style = mapInstance.getStyle();
10
- var layers = style && style.layers ? style.layers : [];
11
- for(var i = 0; i < layers.length; i++){
12
- var layer = layers[i];
13
- var layerId = layer.id;
14
- var layerType = layer.type;
15
- var shouldHide = false;
16
-
17
- if(layerType === 'symbol' || layerType === 'fill-extrusion' || layerType === 'hillshade'){
18
- shouldHide = true;
19
- }
20
-
21
- if(aggressive && (layerType === 'line' || layerType === 'circle')){
22
- var layerIdLower = String(layerId || '').toLowerCase();
23
- if(
24
- layerIdLower.indexOf('road-label') !== -1 ||
25
- layerIdLower.indexOf('poi') !== -1 ||
26
- layerIdLower.indexOf('label') !== -1 ||
27
- layerIdLower.indexOf('boundary') !== -1 ||
28
- layerIdLower.indexOf('admin') !== -1
29
- ){
30
- shouldHide = true;
31
- }
32
- }
33
-
34
- if(shouldHide){
35
- try{
36
- mapInstance.setLayoutProperty(layerId, 'visibility', 'none');
37
- } catch (_) {}
38
- }
39
- }
40
- }
41
-
42
- function setOverlayLayersVisibility(mapInstance, visibility){
43
- if(!mapInstance) return;
44
- var style = mapInstance.getStyle();
45
- var layers = style && style.layers ? style.layers : [];
46
- for(var i = 0; i < layers.length; i++){
47
- var layer = layers[i];
48
- var layerId = String(layer.id || '');
49
- var isCustomOverlay =
50
- layerId.indexOf('-polylines-layout') !== -1 ||
51
- layerId.indexOf('-polygons-fill') !== -1 ||
52
- layerId.indexOf('-polygons-stroke') !== -1;
53
-
54
- if(isCustomOverlay){
55
- try{
56
- mapInstance.setLayoutProperty(layerId, 'visibility', visibility);
57
- } catch (_) {}
58
- }
59
- }
60
- }
61
-
62
-
63
-
64
-
65
- map = new maplibregl.Map({
66
- container: 'map',
67
- style: params.mapStyle,
68
- center: params.center,
69
- zoom: params.zoom,
70
- scrollZoom: params.scrollEnabled,
71
- doubleClickZoom: params.zoomEnabled,
72
- touchZoomRotate: params.zoomEnabled,
73
- minZoom: params.minZoom,
74
- maxZoom: params.maxZoom,
75
- dragPan: params.scrollEnabled,
76
- dragRotate: params.zoomEnabled,
77
- antialias: params.antialias ?? false,
78
- crossSourceCollisions: params.crossSourceCollisions ?? true,
79
- fadeDuration: params.fadeDuration ?? 120,
80
- pixelRatio: params.pixelRatio,
81
- renderWorldCopies: params.renderWorldCopies ?? true
82
- });
83
-
84
- if (typeof params.maxPitch === 'number') {
85
- map.setMaxPitch(params.maxPitch);
86
- }
87
-
88
- if (params.maxPitch === 0) {
89
- map.dragRotate.disable();
90
- map.touchZoomRotate.disableRotation();
91
- }
92
-
93
-
94
-
95
- function getEventParams(){
96
- if(!map) return {
97
- center: null,
98
- zoom: null
99
- }
100
- var center = map.getCenter();
101
- var zoom = map.getZoom();
102
-
103
-
104
- return {
105
- center: center,
106
- zoom: zoom
107
- }
108
- }
109
-
110
- map.on('error', function(event){
111
-
112
-
113
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'event', event: 'error', params: event }));
114
- })
115
-
116
- //movestart moveend
117
- map.on("movestart", function(event){
118
- if(params.turboWhileMoving){
119
- setOverlayLayersVisibility(map, 'none');
120
- }
121
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'event', event: 'movestart', params: getEventParams() }));
122
- })
123
- map.on("moveend", function(event){
124
- if(params.turboWhileMoving){
125
- setOverlayLayersVisibility(map, 'visible');
126
- }
127
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'event', event: 'moveend', params: getEventParams() }));
128
- })
129
- /*zoomstart zoomend*/
130
- map.on("zoomstart", function(event){
131
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'event', event: 'zoomstart', params: getEventParams() }));
132
- })
133
- map.on("zoomend", function(event){
134
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'event', event: 'zoomend', params: getEventParams() }));
135
- })
136
-
137
-
138
- map.on("idle", function(event){
139
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'event', event: 'idle', params: getEventParams() }));
140
- })
141
-
142
-
143
-
144
-
145
-
146
- map.on('load', function () {
147
- if(params.simplifyStyle){
148
- simplifyStyle(map, Boolean(params.aggressiveSimplifyStyle));
149
- }
150
-
151
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'inited' }));
152
- });
153
-
154
-
155
-
156
- }
157
- `;
158
- //# sourceMappingURL=initWeb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/webFunctions/initWeb.ts"],"mappings":";;AAAA,eAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- export default /*js*/`
4
-
5
- if(functionName === 'removeMarker') {
6
- if(markers[params.uniqueId]){
7
- markers[params.uniqueId].remove();
8
- delete markers[params.uniqueId];
9
- }
10
- }
11
- `;
12
- //# sourceMappingURL=removeMarkerWeb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/webFunctions/removeMarkerWeb.ts"],"mappings":";;AAAA,eAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa","ignoreList":[]}
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- export default /*js*/`
4
-
5
- if(functionName === 'removePolygon') {
6
- var sourceId = params.uniqueId + '-polygons-source';
7
- var fillLayerId = params.uniqueId + '-polygons-fill';
8
- var strokeLayerId = params.uniqueId + '-polygons-stroke';
9
-
10
- if(map.getLayer(strokeLayerId)) {
11
- map.removeLayer(strokeLayerId);
12
- }
13
- if(map.getLayer(fillLayerId)) {
14
- map.removeLayer(fillLayerId);
15
- }
16
- if(map.getSource(sourceId)) {
17
- map.removeSource(sourceId);
18
- }
19
-
20
- }
21
- `;
22
- //# sourceMappingURL=removePolygonWeb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/webFunctions/removePolygonWeb.ts"],"mappings":";;AAAA,eAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- export default /*js*/`
4
-
5
- if(functionName === 'removePolyline') {
6
- var sourceId = params.uniqueId + '-polylines-source';
7
- var layerId = params.uniqueId + '-polylines-layout';
8
-
9
- if(map.getLayer(layerId)) {
10
- map.removeLayer(layerId);
11
- }
12
- if(map.getSource(sourceId)) {
13
- map.removeSource(sourceId);
14
- }
15
- }
16
- `;
17
- //# sourceMappingURL=removePolylineWeb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/webFunctions/removePolylineWeb.ts"],"mappings":";;AAAA,eAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa","ignoreList":[]}