From 3b002ce9e2a15b535ecc989f04bf1afabd647ed9 Mon Sep 17 00:00:00 2001 From: LucaHaverty Date: Thu, 22 Aug 2024 11:04:53 -0700 Subject: [PATCH 1/2] Small modal spacing tweaks and control scheme deletion fix --- fission/src/ui/components/Modal.tsx | 4 +- .../src/ui/components/StyledComponents.tsx | 4 +- .../ui/modals/configuring/SettingsModal.tsx | 43 ++++++++++++------- .../theme-editor/NewInputSchemeModal.tsx | 2 +- .../configuring/ChooseInputSchemePanel.tsx | 1 - .../inputs/ConfigureInputsInterface.tsx | 13 +++++- 6 files changed, 43 insertions(+), 24 deletions(-) diff --git a/fission/src/ui/components/Modal.tsx b/fission/src/ui/components/Modal.tsx index 3dad42319..ad7357bb1 100644 --- a/fission/src/ui/components/Modal.tsx +++ b/fission/src/ui/components/Modal.tsx @@ -56,7 +56,7 @@ const Modal: React.FC = ({
{name && ( diff --git a/fission/src/ui/components/StyledComponents.tsx b/fission/src/ui/components/StyledComponents.tsx index 66e404d71..a42896b75 100644 --- a/fission/src/ui/components/StyledComponents.tsx +++ b/fission/src/ui/components/StyledComponents.tsx @@ -3,7 +3,6 @@ import Label, { LabelSize } from "./Label" import Button, { ButtonProps, ButtonSize } from "./Button" import { IoCheckmark, IoPencil, IoPeople, IoTrashBin } from "react-icons/io5" import { HiDownload } from "react-icons/hi" -import { AiOutlinePlus } from "react-icons/ai" import { BiRefresh } from "react-icons/bi" import { AiFillWarning } from "react-icons/ai" import { BsCodeSquare } from "react-icons/bs" @@ -58,7 +57,8 @@ export class SynthesisIcons { /** Large icons: used for icon buttons */ public static DeleteLarge = () public static DownloadLarge = () - public static AddLarge = () + public static AddLarge = () + public static GearLarge = () public static RefreshLarge = () public static SelectLarge = () public static EditLarge = () diff --git a/fission/src/ui/modals/configuring/SettingsModal.tsx b/fission/src/ui/modals/configuring/SettingsModal.tsx index 006666d7b..ce9f1b6a3 100644 --- a/fission/src/ui/modals/configuring/SettingsModal.tsx +++ b/fission/src/ui/modals/configuring/SettingsModal.tsx @@ -1,22 +1,22 @@ import React, { useState } from "react" import Modal, { ModalPropsImpl } from "@/components/Modal" -import { FaGear } from "react-icons/fa6" import Label, { LabelSize } from "@/components/Label" import Dropdown from "@/components/Dropdown" -import Slider from "@/components/Slider" import Checkbox from "@/components/Checkbox" import PreferencesSystem from "@/systems/preferences/PreferencesSystem" import { SceneOverlayEvent, SceneOverlayEventKey } from "@/ui/components/SceneOverlayEvents" import { QualitySetting } from "@/systems/preferences/PreferenceTypes" import { Box } from "@mui/material" -import { Spacer } from "@/ui/components/StyledComponents" +import { Spacer, SynthesisIcons } from "@/ui/components/StyledComponents" import World from "@/systems/World" const SettingsModal: React.FC = ({ modalId }) => { const [qualitySettings, setQualitySettings] = useState( PreferencesSystem.getGlobalPreference("QualitySettings") ) - const [zoomSensitivity, setZoomSensitivity] = useState( + + // Disabled until camera settings are implemented + /* const [zoomSensitivity, setZoomSensitivity] = useState( PreferencesSystem.getGlobalPreference("ZoomSensitivity") ) const [pitchSensitivity, setPitchSensitivity] = useState( @@ -24,11 +24,15 @@ const SettingsModal: React.FC = ({ modalId }) => { ) const [yawSensitivity, setYawSensitivity] = useState( PreferencesSystem.getGlobalPreference("YawSensitivity") - ) + ) */ + const [reportAnalytics, setReportAnalytics] = useState( PreferencesSystem.getGlobalPreference("ReportAnalytics") ) - const [useMetric, setUseMetric] = useState(PreferencesSystem.getGlobalPreference("UseMetric")) + + // Disabled until use metric is implemented + // const [useMetric, setUseMetric] = useState(PreferencesSystem.getGlobalPreference("UseMetric")) + const [renderScoringZones, setRenderScoringZones] = useState( PreferencesSystem.getGlobalPreference("RenderScoringZones") ) @@ -44,29 +48,32 @@ const SettingsModal: React.FC = ({ modalId }) => { const saveSettings = () => { PreferencesSystem.setGlobalPreference("QualitySettings", qualitySettings) - PreferencesSystem.setGlobalPreference("ZoomSensitivity", zoomSensitivity) - PreferencesSystem.setGlobalPreference("PitchSensitivity", pitchSensitivity) - PreferencesSystem.setGlobalPreference("YawSensitivity", yawSensitivity) + PreferencesSystem.setGlobalPreference("ReportAnalytics", reportAnalytics) - PreferencesSystem.setGlobalPreference("UseMetric", useMetric) PreferencesSystem.setGlobalPreference("RenderScoringZones", renderScoringZones) PreferencesSystem.setGlobalPreference("RenderSceneTags", renderSceneTags) PreferencesSystem.setGlobalPreference("RenderScoreboard", renderScoreboard) PreferencesSystem.setGlobalPreference("SubsystemGravity", subsystemGravity) + // Disabled until these settings are implemented + /* PreferencesSystem.setGlobalPreference("ZoomSensitivity", zoomSensitivity) + PreferencesSystem.setGlobalPreference("PitchSensitivity", pitchSensitivity) + PreferencesSystem.setGlobalPreference("YawSensitivity", yawSensitivity) + PreferencesSystem.setGlobalPreference("UseMetric", useMetric) */ + PreferencesSystem.savePreferences() } return ( } + icon={SynthesisIcons.GearLarge} modalId={modalId} onAccept={() => { saveSettings() }} > -
+
= ({ modalId }) => { World.SceneRenderer.ChangeLighting(selected) }} /> - {Spacer(5)} + + {/* Disabled until these settings are implemented */} + {/* {Spacer(5)} = ({ modalId }) => { format={{ maximumFractionDigits: 2 }} onChange={(_, value) => setYawSensitivity(value as number)} tooltipText="Moving the camera left and right." - /> + />*/} {Spacer(20)} @@ -118,13 +127,15 @@ const SettingsModal: React.FC = ({ modalId }) => { }} tooltipText="Record user data such as what robots are spawned and how they are configured. No personal data will be collected." /> - ("UseMetric")} onClick={checked => { setUseMetric(checked) }} - /> + tooltipText="Metric measurements. (ex: meters instead of feet)" + /> */} ("SubsystemGravity")} diff --git a/fission/src/ui/modals/configuring/theme-editor/NewInputSchemeModal.tsx b/fission/src/ui/modals/configuring/theme-editor/NewInputSchemeModal.tsx index 81c59769a..06b95d7a1 100644 --- a/fission/src/ui/modals/configuring/theme-editor/NewInputSchemeModal.tsx +++ b/fission/src/ui/modals/configuring/theme-editor/NewInputSchemeModal.tsx @@ -16,7 +16,7 @@ const NewInputSchemeModal: React.FC = ({ modalId }) => { return ( { const scheme = DefaultInputs.newBlankScheme diff --git a/fission/src/ui/panels/configuring/ChooseInputSchemePanel.tsx b/fission/src/ui/panels/configuring/ChooseInputSchemePanel.tsx index 40a2ed7a8..0d5b549f3 100644 --- a/fission/src/ui/panels/configuring/ChooseInputSchemePanel.tsx +++ b/fission/src/ui/panels/configuring/ChooseInputSchemePanel.tsx @@ -73,7 +73,6 @@ const ChooseInputSchemePanel: React.FC = ({ panelId }) => { sidePadding={8} acceptEnabled={false} icon={SynthesisIcons.Gamepad} - cancelEnabled={selectedBrainIndexGlobal != undefined} cancelName="Close" > {/** A scroll view with buttons to select default and custom input schemes */} diff --git a/fission/src/ui/panels/configuring/assembly-config/interfaces/inputs/ConfigureInputsInterface.tsx b/fission/src/ui/panels/configuring/assembly-config/interfaces/inputs/ConfigureInputsInterface.tsx index 913ad32b4..175bca83a 100644 --- a/fission/src/ui/panels/configuring/assembly-config/interfaces/inputs/ConfigureInputsInterface.tsx +++ b/fission/src/ui/panels/configuring/assembly-config/interfaces/inputs/ConfigureInputsInterface.tsx @@ -77,10 +77,19 @@ const ConfigureInputsInterface = () => { // Fetch current custom schemes InputSchemeManager.saveSchemes() InputSchemeManager.resetDefaultSchemes() - const schemes = PreferencesSystem.getGlobalPreference("InputSchemes") - // Find and remove this input scheme + // Find the scheme to remove in preferences + const schemes = PreferencesSystem.getGlobalPreference("InputSchemes") const index = schemes.indexOf(val.scheme) + + // If currently bound to a robot, remove the binding + for (const [key, value] of InputSystem.brainIndexSchemeMap.entries()) { + if (value == schemes[index]) { + InputSystem.brainIndexSchemeMap.delete(key) + } + } + + // Find and remove this input scheme from preferences schemes.splice(index, 1) // Save to preferences From 0887cb891b16b8a6ad0bfd61b115f4b806763e30 Mon Sep 17 00:00:00 2001 From: LucaHaverty Date: Fri, 23 Aug 2024 12:14:17 -0700 Subject: [PATCH 2/2] settings modal fix --- fission/src/ui/modals/configuring/SettingsModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fission/src/ui/modals/configuring/SettingsModal.tsx b/fission/src/ui/modals/configuring/SettingsModal.tsx index ce9f1b6a3..6f54dd1f0 100644 --- a/fission/src/ui/modals/configuring/SettingsModal.tsx +++ b/fission/src/ui/modals/configuring/SettingsModal.tsx @@ -73,7 +73,7 @@ const SettingsModal: React.FC = ({ modalId }) => { saveSettings() }} > -
+