From 48b80853683aa6b5874b2ccc1794c5c4cc1e8d85 Mon Sep 17 00:00:00 2001 From: Jeff Innes Date: Mon, 1 Jun 2026 14:59:59 -0700 Subject: [PATCH] feat: update orbitalSim and provider to receive the defaultZoom value as a prop Instead of getting the defaultZoom value from the orbitData object --- .../epo-widget-lib/src/mock-data/OrbitalSim/index.ts | 4 ---- .../OrbitalSim/Context/OrbitalSimContext.types.ts | 3 ++- .../src/widgets/OrbitalSim/Context/index.tsx | 4 +++- .../src/widgets/OrbitalSim/OrbitalSim.stories.tsx | 9 +++++++++ .../epo-widget-lib/src/widgets/OrbitalSim/OrbitalSim.tsx | 6 ++---- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/epo-widget-lib/src/mock-data/OrbitalSim/index.ts b/packages/epo-widget-lib/src/mock-data/OrbitalSim/index.ts index 9a205c49..a9f4986e 100644 --- a/packages/epo-widget-lib/src/mock-data/OrbitalSim/index.ts +++ b/packages/epo-widget-lib/src/mock-data/OrbitalSim/index.ts @@ -7,7 +7,6 @@ export const SwappableOrbitsData = { atira, amor ], - defaultZoom: 3 }, swappableOrbits: true } @@ -58,7 +57,6 @@ export const PrimaryData = { selectionCallback: () => {}, paused: true, pov: "top", - defaultZoom: 3, potentialOrbits: null, observations: null, noDetails: true, @@ -18090,7 +18088,6 @@ export const PotentialOrbitsData = { selectionCallback: () => {}, paused: null, pov: null, - defaultZoom: 3, potentialOrbits: true, observations: [ { @@ -18250,7 +18247,6 @@ export const ObjectDetailsData = { selectionCallback: () => {}, paused: null, pov: null, - defaultZoom: 3, potentialOrbits: null, observations: null, detailsSet: "hazardous-asteroids", diff --git a/packages/epo-widget-lib/src/widgets/OrbitalSim/Context/OrbitalSimContext.types.ts b/packages/epo-widget-lib/src/widgets/OrbitalSim/Context/OrbitalSimContext.types.ts index a489999d..2fb2e5d9 100644 --- a/packages/epo-widget-lib/src/widgets/OrbitalSim/Context/OrbitalSimContext.types.ts +++ b/packages/epo-widget-lib/src/widgets/OrbitalSim/Context/OrbitalSimContext.types.ts @@ -3,6 +3,7 @@ import { ReactNode } from "react"; export interface OrbitalSimProviderProps { children: ReactNode, orbitData: Orbits, + defaultZoom: number, showDetailsTable?: boolean, allowOrbitRotation?: boolean, showTimeControls?: boolean, @@ -14,6 +15,7 @@ export interface OrbitalSimProviderProps { export type OrbitalSimContextValues = { orbits: Orbits; + defaultZoom: number; showDetailsTable?: boolean; allowOrbitRotation?: boolean; showTimeControls?: boolean; @@ -56,7 +58,6 @@ export type Orbits = { observations: Observation[], paused: boolean, pov: string | null, - defaultZoom: number | null, potentialOrbits: boolean, noDetails: boolean, refObjs: string[] | null, diff --git a/packages/epo-widget-lib/src/widgets/OrbitalSim/Context/index.tsx b/packages/epo-widget-lib/src/widgets/OrbitalSim/Context/index.tsx index 917aa221..91dd2126 100644 --- a/packages/epo-widget-lib/src/widgets/OrbitalSim/Context/index.tsx +++ b/packages/epo-widget-lib/src/widgets/OrbitalSim/Context/index.tsx @@ -44,6 +44,7 @@ export function useOrbitalSimContext() { export function OrbitalSimProvider({ children, orbitData, + defaultZoom, showDetailsTable=false, allowOrbitRotation=false, showTimeControls=false, @@ -58,7 +59,6 @@ export function OrbitalSimProvider({ observations: [], paused: false, pov: null, - defaultZoom: null, potentialOrbits: false, noDetails: false, refObjs: null, @@ -95,6 +95,7 @@ export function OrbitalSimProvider({ const values: OrbitalSimContextValues = useMemo(() => ({ orbits, + defaultZoom, showDetailsTable, allowOrbitRotation, showTimeControls, @@ -106,6 +107,7 @@ export function OrbitalSimProvider({ selectedNeoIndex }),[ orbits, + defaultZoom, showDetailsTable, allowOrbitRotation, showTimeControls, diff --git a/packages/epo-widget-lib/src/widgets/OrbitalSim/OrbitalSim.stories.tsx b/packages/epo-widget-lib/src/widgets/OrbitalSim/OrbitalSim.stories.tsx index 8ed76afd..36b8ad93 100644 --- a/packages/epo-widget-lib/src/widgets/OrbitalSim/OrbitalSim.stories.tsx +++ b/packages/epo-widget-lib/src/widgets/OrbitalSim/OrbitalSim.stories.tsx @@ -8,6 +8,14 @@ import { PrimaryData, PotentialOrbitsData, ObjectDetailsData, SwappableOrbitsDat const meta: Meta = { component: OrbitalSim, parameters: { r3f: true }, + args: { + defaultZoom: 0.5, + }, + argTypes: { + defaultZoom: { + control: { type: 'number', step: 0.01 }, + }, + }, }; export default meta; @@ -24,6 +32,7 @@ const Template: StoryFn = (args:any ) => { {args.observations && } {