@reearth/core 0.0.7-alpha.20 → 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/dist/index.d.ts CHANGED
@@ -163,7 +163,7 @@ export declare type Cesium3DTilesAppearance = {
163
163
  color?: string;
164
164
  styleUrl?: string;
165
165
  shadows?: "disabled" | "enabled" | "cast_only" | "receive_only";
166
- colorBlendMode?: "highlight" | "replace" | "mix" | "default";
166
+ colorBlendMode?: "highlight" | "replace" | "mix";
167
167
  edgeWidth?: number;
168
168
  edgeColor?: string;
169
169
  selectedFeatureColor?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reearth/core",
3
- "version": "0.0.7-alpha.20",
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.",
@@ -546,7 +546,7 @@ export const colorBlendMode = (colorBlendMode?: "highlight" | "replace" | "mix"
546
546
  )[colorBlendMode || ""];
547
547
 
548
548
  export const colorBlendModeFor3DTile = (
549
- colorBlendMode?: "highlight" | "replace" | "mix" | "default",
549
+ colorBlendMode: "highlight" | "replace" | "mix" = "highlight",
550
550
  ) =>
551
551
  (
552
552
  ({
@@ -554,7 +554,7 @@ export const colorBlendModeFor3DTile = (
554
554
  replace: Cesium3DTileColorBlendMode.REPLACE,
555
555
  mix: Cesium3DTileColorBlendMode.MIX,
556
556
  }) as { [key in string]?: Cesium3DTileColorBlendMode }
557
- )[colorBlendMode || ""];
557
+ )[colorBlendMode]
558
558
 
559
559
  export const heightReference = (
560
560
  heightReference?: "none" | "clamp" | "relative",
@@ -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 };
@@ -194,7 +194,7 @@ export type Cesium3DTilesAppearance = {
194
194
  color?: string;
195
195
  styleUrl?: string;
196
196
  shadows?: "disabled" | "enabled" | "cast_only" | "receive_only";
197
- colorBlendMode?: "highlight" | "replace" | "mix" | "default";
197
+ colorBlendMode?: "highlight" | "replace" | "mix";
198
198
  edgeWidth?: number;
199
199
  edgeColor?: string;
200
200
  selectedFeatureColor?: string; // This doesn't support expression