@reearth/core 0.0.7-alpha.37 → 0.0.7-alpha.38
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/core.js +9 -7
- package/dist/core.umd.cjs +3 -3
- package/dist/index.d.ts +12 -4
- package/package.json +1 -1
- package/src/Map/types/index.ts +11 -3
- package/src/Visualizer/index.tsx +2 -2
- package/src/engines/Cesium/common.ts +8 -7
- package/src/engines/Cesium/hooks.ts +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -368,13 +368,21 @@ export declare type CoreVisualizerProps = {
|
|
|
368
368
|
onSketchFeatureDelete?: (layerId: string, featureId: string) => void;
|
|
369
369
|
onInteractionModeChange?: (mode: InteractionModeType) => void;
|
|
370
370
|
onAPIReady?: () => void;
|
|
371
|
-
onCreditsUpdate?: (credits
|
|
371
|
+
onCreditsUpdate?: (credits?: Credits) => void;
|
|
372
372
|
};
|
|
373
373
|
|
|
374
|
-
export declare type
|
|
374
|
+
export declare type CreditItem = {
|
|
375
375
|
html?: string;
|
|
376
376
|
};
|
|
377
377
|
|
|
378
|
+
export declare type Credits = {
|
|
379
|
+
engine: {
|
|
380
|
+
cesium?: CreditItem;
|
|
381
|
+
};
|
|
382
|
+
lightbox: CreditItem[];
|
|
383
|
+
screen: CreditItem[];
|
|
384
|
+
};
|
|
385
|
+
|
|
378
386
|
declare type CursorType = "default" | "auto" | "help" | "pointer" | "grab" | "crosshair" | "wait";
|
|
379
387
|
|
|
380
388
|
export declare type Data = {
|
|
@@ -518,7 +526,7 @@ export declare type EngineProps = {
|
|
|
518
526
|
onLayerSelectWithRectStart?: (e: LayerSelectWithRectStart) => void;
|
|
519
527
|
onLayerSelectWithRectMove?: (e: LayerSelectWithRectMove) => void;
|
|
520
528
|
onLayerSelectWithRectEnd?: (e: LayerSelectWithRectEnd) => void;
|
|
521
|
-
onCreditsUpdate?: (credits
|
|
529
|
+
onCreditsUpdate?: (credits?: Credits) => void;
|
|
522
530
|
};
|
|
523
531
|
|
|
524
532
|
export declare type EngineRef = {
|
|
@@ -607,7 +615,7 @@ export declare type EngineRef = {
|
|
|
607
615
|
unselectFeatures: (layerId: string, featureId: string[]) => void;
|
|
608
616
|
pickManyFromViewport: (windowPosition: [x: number, y: number], windowWidth: number, windowHeight: number, condition?: (f: PickedFeature) => boolean) => PickedFeature[] | undefined;
|
|
609
617
|
calcRectangleControlPoint: (p1: Position3d, p2: Position3d, p3: Position3d) => [p1: Position3d, p2: Position3d, p3: Position3d];
|
|
610
|
-
getCredits: () =>
|
|
618
|
+
getCredits: () => Credits | undefined;
|
|
611
619
|
} & MouseEventHandles;
|
|
612
620
|
|
|
613
621
|
export declare const engines: {
|
package/package.json
CHANGED
package/src/Map/types/index.ts
CHANGED
|
@@ -212,7 +212,7 @@ export type EngineRef = {
|
|
|
212
212
|
p2: Position3d,
|
|
213
213
|
p3: Position3d,
|
|
214
214
|
) => [p1: Position3d, p2: Position3d, p3: Position3d];
|
|
215
|
-
getCredits: () =>
|
|
215
|
+
getCredits: () => Credits | undefined;
|
|
216
216
|
} & MouseEventHandles;
|
|
217
217
|
|
|
218
218
|
export type EngineProps = {
|
|
@@ -261,7 +261,7 @@ export type EngineProps = {
|
|
|
261
261
|
onLayerSelectWithRectStart?: (e: LayerSelectWithRectStart) => void;
|
|
262
262
|
onLayerSelectWithRectMove?: (e: LayerSelectWithRectMove) => void;
|
|
263
263
|
onLayerSelectWithRectEnd?: (e: LayerSelectWithRectEnd) => void;
|
|
264
|
-
onCreditsUpdate?: (credits
|
|
264
|
+
onCreditsUpdate?: (credits?: Credits) => void;
|
|
265
265
|
};
|
|
266
266
|
|
|
267
267
|
export type LayerEditEvent = {
|
|
@@ -386,6 +386,14 @@ export type SketchRef = {
|
|
|
386
386
|
onEditFeatureChange: (cb: SketchEditFeatureChangeCb) => void;
|
|
387
387
|
};
|
|
388
388
|
|
|
389
|
-
export type
|
|
389
|
+
export type CreditItem = {
|
|
390
390
|
html?: string;
|
|
391
391
|
};
|
|
392
|
+
|
|
393
|
+
export type Credits = {
|
|
394
|
+
engine: {
|
|
395
|
+
cesium?: CreditItem;
|
|
396
|
+
};
|
|
397
|
+
lightbox: CreditItem[];
|
|
398
|
+
screen: CreditItem[];
|
|
399
|
+
};
|
package/src/Visualizer/index.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
type LatLng,
|
|
13
13
|
type Cluster,
|
|
14
14
|
type ComputedLayer,
|
|
15
|
-
type
|
|
15
|
+
type Credits,
|
|
16
16
|
} from "../Map";
|
|
17
17
|
import { SketchFeature, SketchType } from "../Map/Sketch/types";
|
|
18
18
|
|
|
@@ -64,7 +64,7 @@ export type CoreVisualizerProps = {
|
|
|
64
64
|
onSketchFeatureDelete?: (layerId: string, featureId: string) => void;
|
|
65
65
|
onInteractionModeChange?: (mode: InteractionModeType) => void;
|
|
66
66
|
onAPIReady?: () => void;
|
|
67
|
-
onCreditsUpdate?: (credits
|
|
67
|
+
onCreditsUpdate?: (credits?: Credits) => void;
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
export const CoreVisualizer = memo(
|
|
@@ -42,6 +42,7 @@ import { MutableRefObject, useMemo } from "react";
|
|
|
42
42
|
|
|
43
43
|
import type { Camera, Clock } from "..";
|
|
44
44
|
import { ClassificationType } from "../../mantle";
|
|
45
|
+
import { Credits } from "../../Map";
|
|
45
46
|
import type {
|
|
46
47
|
CameraOptions,
|
|
47
48
|
FlyToDestination,
|
|
@@ -919,17 +920,17 @@ export function getCredits(viewer: Viewer) {
|
|
|
919
920
|
const { lightboxCredits, screenCredits } = creditDisplay?._currentFrameCredits || {};
|
|
920
921
|
const cesiumCredits = creditDisplay._currentCesiumCredit;
|
|
921
922
|
|
|
922
|
-
const credits: {
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
923
|
+
const credits: Credits = {
|
|
924
|
+
engine: {
|
|
925
|
+
cesium: cesiumCredits?.html ? { html: cesiumCredits.html } : undefined,
|
|
926
|
+
},
|
|
927
|
+
lightbox: Array.from(lightboxCredits?._array ?? []).map(c => ({
|
|
927
928
|
html: c?.credit?.html,
|
|
928
929
|
})),
|
|
929
|
-
|
|
930
|
+
screen: Array.from(screenCredits?._array ?? []).map(c => ({
|
|
930
931
|
html: c?.credit?.html,
|
|
931
932
|
})),
|
|
932
|
-
|
|
933
|
+
};
|
|
933
934
|
|
|
934
935
|
return credits;
|
|
935
936
|
}
|
|
@@ -27,7 +27,7 @@ import type {
|
|
|
27
27
|
import { e2eAccessToken, setE2ECesiumViewer } from "../../e2eConfig";
|
|
28
28
|
import { ComputedFeature, DataType, SelectedFeatureInfo, LatLng, Camera } from "../../mantle";
|
|
29
29
|
import {
|
|
30
|
-
|
|
30
|
+
Credits,
|
|
31
31
|
LayerLoadEvent,
|
|
32
32
|
LayerSelectWithRectEnd,
|
|
33
33
|
LayerSelectWithRectMove,
|
|
@@ -130,7 +130,7 @@ export default ({
|
|
|
130
130
|
onLayerLoad?: (e: LayerLoadEvent) => void;
|
|
131
131
|
onCameraChange?: (camera: Camera) => void;
|
|
132
132
|
onMount?: () => void;
|
|
133
|
-
onCreditsUpdate?: (credits
|
|
133
|
+
onCreditsUpdate?: (credits?: Credits) => void;
|
|
134
134
|
}) => {
|
|
135
135
|
const cesium = useRef<CesiumComponentRef<CesiumViewer>>(null);
|
|
136
136
|
|
|
@@ -665,7 +665,7 @@ export default ({
|
|
|
665
665
|
if (!onCreditsUpdateRef.current) return;
|
|
666
666
|
const viewer = cesium.current?.cesiumElement;
|
|
667
667
|
if (!viewer || viewer.isDestroyed()) return;
|
|
668
|
-
const credits
|
|
668
|
+
const credits = getCredits(viewer);
|
|
669
669
|
onCreditsUpdateRef.current(credits);
|
|
670
670
|
}, 3000);
|
|
671
671
|
}, []);
|