react-native-maplibre-lite 0.1.3 → 0.1.5

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 +58 -21
  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 +29 -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 +90 -48
  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 -188
  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 -185
  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,188 +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
- // Keep labels (streets / addresses) visible — hide only expensive visual layers by default.
18
- if(layerType === 'fill-extrusion' || layerType === 'hillshade'){
19
- shouldHide = true;
20
- }
21
-
22
- if(layerType === 'symbol' && aggressive){
23
- var idLower = String(layerId || '').toLowerCase();
24
- var sourceLayerLower = String(layer['source-layer'] || '').toLowerCase();
25
-
26
- // Keep road + address/house number labels.
27
- var keepLabel =
28
- idLower.indexOf('road') !== -1 ||
29
- idLower.indexOf('street') !== -1 ||
30
- idLower.indexOf('housenumber') !== -1 ||
31
- idLower.indexOf('house_number') !== -1 ||
32
- idLower.indexOf('house-number') !== -1 ||
33
- idLower.indexOf('address') !== -1 ||
34
- sourceLayerLower.indexOf('housenumber') !== -1 ||
35
- sourceLayerLower.indexOf('house') !== -1 ||
36
- sourceLayerLower.indexOf('address') !== -1;
37
-
38
- // Hide most POI/other symbols in aggressive mode.
39
- var hideSymbol =
40
- idLower.indexOf('poi') !== -1 ||
41
- idLower.indexOf('transit') !== -1 ||
42
- idLower.indexOf('airport') !== -1 ||
43
- idLower.indexOf('rail') !== -1 ||
44
- idLower.indexOf('ferry') !== -1;
45
-
46
- if(!keepLabel && hideSymbol){
47
- shouldHide = true;
48
- }
49
- }
50
-
51
- if(aggressive && (layerType === 'line' || layerType === 'circle')){
52
- var layerIdLower = String(layerId || '').toLowerCase();
53
- if(
54
- layerIdLower.indexOf('road-label') !== -1 ||
55
- layerIdLower.indexOf('poi') !== -1 ||
56
- layerIdLower.indexOf('label') !== -1 ||
57
- layerIdLower.indexOf('boundary') !== -1 ||
58
- layerIdLower.indexOf('admin') !== -1
59
- ){
60
- shouldHide = true;
61
- }
62
- }
63
-
64
- if(shouldHide){
65
- try{
66
- mapInstance.setLayoutProperty(layerId, 'visibility', 'none');
67
- } catch (_) {}
68
- }
69
- }
70
- }
71
-
72
- function setOverlayLayersVisibility(mapInstance, visibility){
73
- if(!mapInstance) return;
74
- var style = mapInstance.getStyle();
75
- var layers = style && style.layers ? style.layers : [];
76
- for(var i = 0; i < layers.length; i++){
77
- var layer = layers[i];
78
- var layerId = String(layer.id || '');
79
- var isCustomOverlay =
80
- layerId.indexOf('-polylines-layout') !== -1 ||
81
- layerId.indexOf('-polygons-fill') !== -1 ||
82
- layerId.indexOf('-polygons-stroke') !== -1;
83
-
84
- if(isCustomOverlay){
85
- try{
86
- mapInstance.setLayoutProperty(layerId, 'visibility', visibility);
87
- } catch (_) {}
88
- }
89
- }
90
- }
91
-
92
-
93
-
94
-
95
- map = new maplibregl.Map({
96
- container: 'map',
97
- style: params.mapStyle,
98
- center: params.center,
99
- zoom: params.zoom,
100
- scrollZoom: params.scrollEnabled,
101
- doubleClickZoom: params.zoomEnabled,
102
- touchZoomRotate: params.zoomEnabled,
103
- minZoom: params.minZoom,
104
- maxZoom: params.maxZoom,
105
- dragPan: params.scrollEnabled,
106
- dragRotate: params.zoomEnabled,
107
- antialias: params.antialias ?? false,
108
- crossSourceCollisions: params.crossSourceCollisions ?? true,
109
- fadeDuration: params.fadeDuration ?? 120,
110
- pixelRatio: params.pixelRatio,
111
- renderWorldCopies: params.renderWorldCopies ?? true
112
- });
113
-
114
- if (typeof params.maxPitch === 'number') {
115
- map.setMaxPitch(params.maxPitch);
116
- }
117
-
118
- if (params.maxPitch === 0) {
119
- map.dragRotate.disable();
120
- map.touchZoomRotate.disableRotation();
121
- }
122
-
123
-
124
-
125
- function getEventParams(){
126
- if(!map) return {
127
- center: null,
128
- zoom: null
129
- }
130
- var center = map.getCenter();
131
- var zoom = map.getZoom();
132
-
133
-
134
- return {
135
- center: center,
136
- zoom: zoom
137
- }
138
- }
139
-
140
- map.on('error', function(event){
141
-
142
-
143
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'event', event: 'error', params: event }));
144
- })
145
-
146
- //movestart moveend
147
- map.on("movestart", function(event){
148
- if(params.turboWhileMoving){
149
- setOverlayLayersVisibility(map, 'none');
150
- }
151
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'event', event: 'movestart', params: getEventParams() }));
152
- })
153
- map.on("moveend", function(event){
154
- if(params.turboWhileMoving){
155
- setOverlayLayersVisibility(map, 'visible');
156
- }
157
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'event', event: 'moveend', params: getEventParams() }));
158
- })
159
- /*zoomstart zoomend*/
160
- map.on("zoomstart", function(event){
161
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'event', event: 'zoomstart', params: getEventParams() }));
162
- })
163
- map.on("zoomend", function(event){
164
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'event', event: 'zoomend', params: getEventParams() }));
165
- })
166
-
167
-
168
- map.on("idle", function(event){
169
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'event', event: 'idle', params: getEventParams() }));
170
- })
171
-
172
-
173
-
174
-
175
-
176
- map.on('load', function () {
177
- if(params.simplifyStyle){
178
- simplifyStyle(map, Boolean(params.aggressiveSimplifyStyle));
179
- }
180
-
181
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'inited' }));
182
- });
183
-
184
-
185
-
186
- }
187
- `;
188
- //# 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;AACA;AACA;AACA;AACA;AACA;AACA;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