@reearth/core 0.0.7-alpha.3 → 0.0.7-alpha.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.
package/dist/index.d.ts CHANGED
@@ -954,6 +954,7 @@ export declare type LayersRef = {
954
954
  }) | null) => void;
955
955
  deleteLayer: (...ids: string[]) => void;
956
956
  isLayer: (obj: any) => obj is LazyLayer;
957
+ isComputedLayer: (obj: any) => obj is ComputedLayer;
957
958
  layers: () => LazyLayer[];
958
959
  walk: <T>(fn: (layer: LazyLayer, index: number, parents: LazyLayer[]) => T | void) => T | undefined;
959
960
  find: (fn: (layer: LazyLayer, index: number, parents: LazyLayer[]) => boolean) => LazyLayer | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reearth/core",
3
- "version": "0.0.7-alpha.3",
3
+ "version": "0.0.7-alpha.5",
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.",
@@ -52,6 +52,7 @@ export type Ref = {
52
52
  override: (id: string, layer?: (Partial<Layer> & { property?: any }) | null) => void;
53
53
  deleteLayer: (...ids: string[]) => void;
54
54
  isLayer: (obj: any) => obj is LazyLayer;
55
+ isComputedLayer: (obj: any) => obj is ComputedLayer;
55
56
  layers: () => LazyLayer[];
56
57
  walk: <T>(
57
58
  fn: (layer: LazyLayer, index: number, parents: LazyLayer[]) => T | void,
@@ -455,6 +456,13 @@ export default function useHooks({
455
456
  [lazyLayerPrototype],
456
457
  );
457
458
 
459
+ const isComputedLayer = useCallback(
460
+ (obj: any): obj is ComputedLayer => {
461
+ return typeof obj === "object" && Object.getPrototypeOf(obj) === lazyComputedLayerPrototype;
462
+ },
463
+ [lazyComputedLayerPrototype],
464
+ );
465
+
458
466
  const rootLayers = useCallback(() => {
459
467
  return [...(layersRef() ?? []), ...tempLayersRef.current]
460
468
  .map(l => findById(l.id))
@@ -551,6 +559,7 @@ export default function useHooks({
551
559
  deleteLayer,
552
560
  findByIds,
553
561
  isLayer,
562
+ isComputedLayer,
554
563
  layers: rootLayers,
555
564
  walk,
556
565
  find,
@@ -575,6 +584,7 @@ export default function useHooks({
575
584
  deleteLayer,
576
585
  findByIds,
577
586
  isLayer,
587
+ isComputedLayer,
578
588
  rootLayers,
579
589
  walk,
580
590
  find,
package/src/Map/ref.ts CHANGED
@@ -103,6 +103,7 @@ const layersRefKeys: FunctionKeys<LayersRef> = {
103
103
  findByTags: 1,
104
104
  hide: 1,
105
105
  isLayer: 1,
106
+ isComputedLayer: 1,
106
107
  layers: 1,
107
108
  override: 1,
108
109
  replace: 1,
@@ -105,6 +105,7 @@ function EntityExtComponent(
105
105
  props.id,
106
106
  unselectable,
107
107
  hideIndicator,
108
+ r.current?.cesiumElement,
108
109
  ]);
109
110
 
110
111
  return <Entity ref={composeRefs(ref, r)} {...props} />;