Skip to content

Commit

Permalink
Fix Presets
Browse files Browse the repository at this point in the history
  • Loading branch information
YeonV committed Jan 3, 2024
1 parent 735b09a commit f1bc6c6
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions src/components/Dialogs/SceneDialogs/EditSceneDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const EditSceneDialog = () => {
const addScene = useStore((state) => state.addScene)
const getScenes = useStore((state) => state.getScenes)
const getLedFxPresets = useStore((state) => state.getLedFxPresets)
const getFullConfig = useStore((state) => state.getFullConfig)

const toggletSceneActiveTag = useStore(
(state) => state.ui.toggletSceneActiveTag
Expand Down Expand Up @@ -175,6 +176,7 @@ const EditSceneDialog = () => {
}

useEffect(() => {
getFullConfig()
getLedFxPresets().then((ledfx_presets) => {
setLp(ledfx_presets)
})
Expand Down Expand Up @@ -245,15 +247,29 @@ const EditSceneDialog = () => {
return ledfxPreset || userPreset ? (
<Select
defaultValue={ledfxPreset || userPreset}
onChange={(e) =>
e.target.value &&
activatePreset(
dev,
ledfxPreset ? 'default_presets' : 'user_presets',
sVirtuals[dev].type,
e.target.value
).then(() => getVirtuals())
}
onChange={(e) => {
let category = 'default_presets'
if (
user_presets &&
user_presets[effectId] &&
Object.prototype.hasOwnProperty.call(
user_presets[effectId],
e.target.value
)
) {
category = 'user_presets'
}

return (
e.target.value &&
activatePreset(
dev,
category,
sVirtuals[dev].type,
e.target.value
).then(() => getVirtuals())
)
}}
disabled={
scVirtualsToIgnore.indexOf(dev) > -1 ||
disabledPSelector.indexOf(dev) > -1
Expand Down

0 comments on commit f1bc6c6

Please sign in to comment.