diff --git a/fission/src/mirabuf/MirabufSceneObject.ts b/fission/src/mirabuf/MirabufSceneObject.ts index 9f592b18f..886f7ca13 100644 --- a/fission/src/mirabuf/MirabufSceneObject.ts +++ b/fission/src/mirabuf/MirabufSceneObject.ts @@ -23,9 +23,15 @@ import SynthesisBrain from "@/systems/simulation/synthesis_brain/SynthesisBrain" import { ContextData, ContextSupplier } from "@/ui/components/ContextMenuData" import { CustomOrbitControls } from "@/systems/scene/CameraControls" import GizmoSceneObject from "@/systems/scene/GizmoSceneObject" -import { ConfigMode, setNextConfigurePanelSettings } from "@/ui/panels/configuring/assembly-config/ConfigurePanelControls" +import { + ConfigMode, + setNextConfigurePanelSettings, +} from "@/ui/panels/configuring/assembly-config/ConfigurePanelControls" import { Global_OpenPanel } from "@/ui/components/GlobalUIControls" -import { ConfigurationType, setSelectedConfigurationType } from "@/ui/panels/configuring/assembly-config/ConfigurationType" +import { + ConfigurationType, + setSelectedConfigurationType, +} from "@/ui/panels/configuring/assembly-config/ConfigurationType" const DEBUG_BODIES = false @@ -485,10 +491,12 @@ class MirabufSceneObject extends SceneObject implements ContextSupplier { data.items.push({ name: "Move", func: () => { - setSelectedConfigurationType(this.miraType == MiraType.ROBOT ? ConfigurationType.ROBOT : ConfigurationType.FIELD) + setSelectedConfigurationType( + this.miraType == MiraType.ROBOT ? ConfigurationType.ROBOT : ConfigurationType.FIELD + ) setNextConfigurePanelSettings({ configMode: ConfigMode.MOVE, - selectedAssembly: this + selectedAssembly: this, }) Global_OpenPanel?.("configure") }, diff --git a/fission/src/systems/scene/CameraControls.ts b/fission/src/systems/scene/CameraControls.ts index 047d87654..fb1ac4150 100644 --- a/fission/src/systems/scene/CameraControls.ts +++ b/fission/src/systems/scene/CameraControls.ts @@ -191,8 +191,7 @@ export class CustomOrbitControls extends CameraControls { public update(deltaT: number): void { deltaT = Math.max(1.0 / 60.0, Math.min(1 / 144.0, deltaT)) - if (this.enabled) - this._focusProvider?.LoadFocusTransform(this._focus) + if (this.enabled) this._focusProvider?.LoadFocusTransform(this._focus) // Generate delta of spherical coordinates const omega: SphericalCoords = this.enabled diff --git a/fission/src/ui/components/MainHUD.tsx b/fission/src/ui/components/MainHUD.tsx index b06cb4035..10b151d4b 100644 --- a/fission/src/ui/components/MainHUD.tsx +++ b/fission/src/ui/components/MainHUD.tsx @@ -143,7 +143,7 @@ const MainHUD: React.FC = () => { icon={SynthesisIcons.Gear} onClick={() => openModal("settings")} /> - { /** Will be coming soonish...tm */ } + {/** Will be coming soonish...tm */} {/* = ({ configurationType, onAssemblySelected, selectedAssembly }) => { +const AssemblySelection: React.FC = ({ + configurationType, + onAssemblySelected, + selectedAssembly, +}) => { // Update is used when a robot or field is deleted to update the select menu const [u, update] = useReducer(x => !x, false) const { openPanel } = usePanelControlContext() @@ -78,7 +82,9 @@ const AssemblySelection: React.FC = ({ configuratio /** Robot or field select menu */ return ( makeSelectionOption(configurationType, assembly))} + options={(configurationType == ConfigurationType.ROBOT ? robots : fields).map(assembly => + makeSelectionOption(configurationType, assembly) + )} onOptionSelected={val => { onAssemblySelected((val as AssemblySelectionOption)?.assemblyObject) }} @@ -92,7 +98,9 @@ const AssemblySelection: React.FC = ({ configuratio openPanel("import-mirabuf") }} noOptionsText={`No ${configurationType == ConfigurationType.ROBOT ? "robots" : "fields"} spawned!`} - defaultSelectedOption={selectedAssembly ? makeSelectionOption(configurationType, selectedAssembly) : undefined} + defaultSelectedOption={ + selectedAssembly ? makeSelectionOption(configurationType, selectedAssembly) : undefined + } /> ) } @@ -107,24 +115,30 @@ class ConfigModeSelectionOption extends SelectMenuOption { } const robotModes: Map = new Map([ - [ ConfigMode.MOVE, new ConfigModeSelectionOption("Move", ConfigMode.MOVE) ], - [ ConfigMode.INTAKE, new ConfigModeSelectionOption("Intake", ConfigMode.INTAKE) ], - [ ConfigMode.EJECTOR, new ConfigModeSelectionOption("Ejector", ConfigMode.EJECTOR) ], - [ ConfigMode.SUBSYSTEMS, new ConfigModeSelectionOption( - "Configure Joints", + [ConfigMode.MOVE, new ConfigModeSelectionOption("Move", ConfigMode.MOVE)], + [ConfigMode.INTAKE, new ConfigModeSelectionOption("Intake", ConfigMode.INTAKE)], + [ConfigMode.EJECTOR, new ConfigModeSelectionOption("Ejector", ConfigMode.EJECTOR)], + [ ConfigMode.SUBSYSTEMS, - "Set the velocities, torques, and accelerations of your robot's motors." - )], - [ ConfigMode.SEQUENTIAL, new ConfigModeSelectionOption( - "Sequence Joints", + new ConfigModeSelectionOption( + "Configure Joints", + ConfigMode.SUBSYSTEMS, + "Set the velocities, torques, and accelerations of your robot's motors." + ), + ], + [ ConfigMode.SEQUENTIAL, - "Set which joints follow each other. For example, the second stage of an elevator could follow the first, moving in unison with it." - )], - [ ConfigMode.CONTROLS, new ConfigModeSelectionOption("Controls", ConfigMode.CONTROLS) ], + new ConfigModeSelectionOption( + "Sequence Joints", + ConfigMode.SEQUENTIAL, + "Set which joints follow each other. For example, the second stage of an elevator could follow the first, moving in unison with it." + ), + ], + [ConfigMode.CONTROLS, new ConfigModeSelectionOption("Controls", ConfigMode.CONTROLS)], ]) const fieldModes: Map = new Map([ - [ ConfigMode.MOVE, new ConfigModeSelectionOption("Move", ConfigMode.MOVE) ], - [ ConfigMode.SCORING_ZONES, new ConfigModeSelectionOption("Scoring Zones", ConfigMode.SCORING_ZONES) ], + [ConfigMode.MOVE, new ConfigModeSelectionOption("Move", ConfigMode.MOVE)], + [ConfigMode.SCORING_ZONES, new ConfigModeSelectionOption("Scoring Zones", ConfigMode.SCORING_ZONES)], ]) interface ConfigModeSelectionProps { @@ -133,7 +147,11 @@ interface ConfigModeSelectionProps { selectedMode?: ConfigMode } -const ConfigModeSelection: React.FC = ({ configurationType, onModeSelected, selectedMode }) => { +const ConfigModeSelection: React.FC = ({ + configurationType, + onModeSelected, + selectedMode, +}) => { return ( = ({ configuration }} defaultHeaderText="Select a Configuration Mode" indentation={1} - defaultSelectedOption={selectedMode ? (configurationType == ConfigurationType.ROBOT ? robotModes.get(selectedMode)! : fieldModes.get(selectedMode)!) : undefined} + defaultSelectedOption={ + selectedMode + ? configurationType == ConfigurationType.ROBOT + ? robotModes.get(selectedMode)! + : fieldModes.get(selectedMode)! + : undefined + } /> ) } diff --git a/fission/src/ui/panels/configuring/assembly-config/ConfigurePanelControls.ts b/fission/src/ui/panels/configuring/assembly-config/ConfigurePanelControls.ts index 555184815..e758f966c 100644 --- a/fission/src/ui/panels/configuring/assembly-config/ConfigurePanelControls.ts +++ b/fission/src/ui/panels/configuring/assembly-config/ConfigurePanelControls.ts @@ -11,18 +11,18 @@ export enum ConfigMode { } export type ConfigurePanelSettings = { - configMode: ConfigMode, - selectedAssembly: MirabufSceneObject, + configMode: ConfigMode + selectedAssembly: MirabufSceneObject } let configurePanelSettings: ConfigurePanelSettings | undefined = undefined export function popConfigurePanelSettings(): ConfigurePanelSettings | undefined { const tmp = configurePanelSettings - configurePanelSettings = undefined; + configurePanelSettings = undefined return tmp } export function setNextConfigurePanelSettings(settings: ConfigurePanelSettings) { configurePanelSettings = settings -} \ No newline at end of file +}