solid-map-gl 1.2.0 → 1.2.3

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.
@@ -6,8 +6,6 @@ export const Marker = props => {
6
6
  let marker = null;
7
7
  // Add Marker
8
8
  createEffect(() => {
9
- if (!map())
10
- return;
11
9
  marker = new mapboxgl.Marker(props.options)
12
10
  .setLngLat(props.lnglat)
13
11
  .setPopup(props.children
@@ -6,8 +6,6 @@ export const Popup = props => {
6
6
  let popup = null;
7
7
  // Add Popup
8
8
  createEffect(() => {
9
- if (!map())
10
- return;
11
9
  popup = new mapboxgl.Popup(props.options)
12
10
  .setLngLat(props.lnglat)
13
11
  .setDOMContent(<div>{props.children}</div>)
@@ -5,16 +5,12 @@ export const Sky = props => {
5
5
  const layerId = '_sky';
6
6
  // Add Sky Layer
7
7
  createEffect(() => {
8
- if (!map())
9
- return;
10
8
  map().getLayer(layerId) && map().addLayer({ ...props.style, id: layerId });
11
9
  });
12
10
  // Remove Sky Layer
13
11
  onCleanup(() => map().getLayer(layerId) && map().removeLayer(layerId));
14
12
  // Update Visibility
15
13
  createEffect(() => {
16
- if (!map())
17
- return;
18
14
  props.visible !== undefined &&
19
15
  map().setLayoutProperty(layerId, 'visibility', props.visible ? 'visible' : 'none');
20
16
  });
@@ -18,8 +18,6 @@ export const Source = props => {
18
18
  : props.source;
19
19
  // Add Source
20
20
  createEffect(() => {
21
- if (!map())
22
- return;
23
21
  const source = lookup(props.source.url);
24
22
  source.tiles &&
25
23
  (source.tiles = ['a', 'b', 'c'].map(i => source.tiles[0].replace('{s}', i)));
@@ -34,8 +32,6 @@ export const Source = props => {
34
32
  });
35
33
  // Update
36
34
  createEffect(() => {
37
- if (!map())
38
- return;
39
35
  const source = map().getSource(props.id);
40
36
  if (!source)
41
37
  return;
@@ -6,16 +6,12 @@ export const Terrain = props => {
6
6
  const sourceId = useSourceId();
7
7
  // Add Terrain Layer
8
8
  createEffect(() => {
9
- if (!map())
10
- return;
11
9
  map().setTerrain({ ...props.style, source: sourceId });
12
10
  });
13
11
  // Remove Terrain Layer
14
12
  onCleanup(() => map().setTerrain(null));
15
13
  // Update Visibility
16
14
  createEffect(() => {
17
- if (!map())
18
- return;
19
15
  props.visible !== undefined &&
20
16
  map().setTerrain(props.visible ? props.style : null);
21
17
  });
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.0",
2
+ "version": "1.2.3",
3
3
  "name": "solid-map-gl",
4
4
  "description": "Solid Component Library for Mapbox GL JS",
5
5
  "info": "Solid Component Library for Mapbox GL JS. Mapbox GL JS is a JavaScript library that renders interactive maps from vector tiles and Mapbox styles using WebGL. This project is intended to be as close as possible to the Mapbox GL JS API.",
@@ -65,6 +65,6 @@
65
65
  "typescript": "^4.6.4",
66
66
  "vite": "^2.9.9",
67
67
  "vite-plugin-solid": "^2.2.6",
68
- "vitest": "^0.12.7"
68
+ "vitest": "^0.12.9"
69
69
  }
70
70
  }