feat: enable feature selection for preview modes and add click interaction support to the selecting engine

This commit is contained in:
taDuc
2026-05-26 01:26:47 +07:00
parent de91f8129e
commit 8306543828
20 changed files with 1356 additions and 332 deletions
+10 -4
View File
@@ -45,6 +45,7 @@ type UseReplayPreviewOptions = {
selectedStageId: number | null;
selectedStepIndex: number | null;
onSelectStep: (stageId: number | null, stepIndex: number | null) => void;
setMapProjection?: (type: "globe" | "mercator") => void;
};
export function useReplayPreview({
@@ -57,6 +58,7 @@ export function useReplayPreview({
selectedStageId,
selectedStepIndex,
onSelectStep,
setMapProjection,
}: UseReplayPreviewOptions) {
const [isPlaying, setIsPlaying] = useState(false);
const [dialog, setDialog] = useState<DialogState | null>(null);
@@ -172,9 +174,13 @@ export function useReplayPreview({
if (map) {
mapActions.restore_label_visibility(map, baseline.labelVisibility);
if (baseline.mapViewState) {
map.setProjection({
type: baseline.mapViewState.projection === "globe" ? "globe" : "mercator",
});
if (setMapProjection) {
setMapProjection(baseline.mapViewState.projection === "globe" ? "globe" : "mercator");
} else {
map.setProjection({
type: baseline.mapViewState.projection === "globe" ? "globe" : "mercator",
});
}
mapActions.set_camera_view(map, {
center: baseline.mapViewState.center,
zoom: baseline.mapViewState.zoom,
@@ -184,7 +190,7 @@ export function useReplayPreview({
});
}
}
}, [getMapInstance, resetPresentation]);
}, [getMapInstance, resetPresentation, setMapProjection]);
const resetPreview = useCallback(() => {
runIdRef.current += 1;