@reearth/core 0.0.7-alpha.21 → 0.0.7-alpha.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reearth/core",
3
- "version": "0.0.7-alpha.21",
3
+ "version": "0.0.7-alpha.22",
4
4
  "author": "Re:Earth contributors <community@reearth.io>",
5
5
  "license": "Apache-2.0",
6
6
  "description": "A library that abstracts a map engine as one common API.",
@@ -113,6 +113,12 @@ export function useImageryProviders({
113
113
  const tileKeys = tiles.map(t => t.id).join(",");
114
114
  const prevTileKeys = useRef(tileKeys);
115
115
  const prevProviders = useRef<Providers>({});
116
+ const zoomLevels = useMemo(() => tiles.map(t => {
117
+ if (t.id && t.zoomLevel) return { [t.id]: t.zoomLevel };
118
+ return
119
+ }),
120
+ [tiles]);
121
+ const prevZoomLevels = useRef(zoomLevels);
116
122
 
117
123
  // Manage TileProviders so that TileProvider does not need to be recreated each time tiles are updated.
118
124
  const { providers, updated } = useMemo(() => {
@@ -174,13 +180,15 @@ export function useImageryProviders({
174
180
  !!added.length ||
175
181
  !!isCesiumAccessTokenUpdated ||
176
182
  !isEqual(prevTileKeys.current, tileKeys) ||
183
+ !isEqual(prevZoomLevels.current, zoomLevels) ||
177
184
  rawProviders.some(p => p.tile && (p.prevType !== p.tile.type || p.prevUrl !== p.tile.url));
178
185
 
179
186
  prevTileKeys.current = tileKeys;
187
+ prevZoomLevels.current = zoomLevels;
180
188
  prevCesiumIonAccessToken.current = cesiumIonAccessToken;
181
189
 
182
190
  return { providers, updated };
183
- }, [cesiumIonAccessToken, tiles, tileKeys, newTile]);
191
+ }, [cesiumIonAccessToken, tiles, tileKeys, newTile, zoomLevels]);
184
192
 
185
193
  prevProviders.current = providers;
186
194
  return { providers, updated };