From 328d0c995bee6eacd660cbda6990ddef9fe41963 Mon Sep 17 00:00:00 2001 From: YeonV Date: Sat, 5 Oct 2024 03:51:46 +0200 Subject: [PATCH] set global colors on lpType change --- src/components/Midi/LaunchpadButtonMap.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/Midi/LaunchpadButtonMap.tsx b/src/components/Midi/LaunchpadButtonMap.tsx index bfa63b04..f84b7f1f 100644 --- a/src/components/Midi/LaunchpadButtonMap.tsx +++ b/src/components/Midi/LaunchpadButtonMap.tsx @@ -6,7 +6,7 @@ import Assign from '../Gamepad/Assign' import { useEffect, useState } from 'react' import { WebMidi } from 'webmidi' import LaunchpadButton from './LaunchpadButton' -import { getColorFromValue } from './lpColors' +import { getColorFromValue, lpsColors } from './lpColors' import { defaultMapping, IMapping, LpMapping } from '../../store/ui/storeMidi' import LaunchpadColors from './LaunchpadColors' import { download } from '../../utils/helpers' @@ -23,6 +23,9 @@ const LaunchpadButtonMap = ({toggleSidebar, sideBarOpen}:{toggleSidebar: () => v const recentScenes = useStore((state) => state.recentScenes) const midiMapping = useStore((state) => state.midiMapping) const setMidiMapping = useStore((state) => state.setMidiMapping) + const setMidiSceneActiveColor = useStore((state) => state.setMidiSceneActiveColor) + const setMidiSceneInactiveColor = useStore((state) => state.setMidiSceneInactiveColor) + const setMidiCommandColor = useStore((state) => state.setMidiCommandColor) const pressedButtonColor = useStore((state) => state.midiColors.pressedButtonColor) const paused = useStore((state) => state.paused) const matrix = Array.from({ length: 9 }, () => Array.from({ length: 9 }, () => 0)) @@ -190,16 +193,22 @@ const LaunchpadButtonMap = ({toggleSidebar, sideBarOpen}:{toggleSidebar: () => v { setMidiMappingButtonNumbers(LpMapping.LaunchpadX) - initMidi() setLpType('LPX') + setMidiSceneActiveColor('1E') + setMidiSceneInactiveColor('3C') + setMidiCommandColor('63') + initMidi() }}> { setMidiMappingButtonNumbers(LpMapping.LaunchpadS) - initMidi() setLpType('LPS') + setMidiSceneActiveColor('3C') + setMidiSceneInactiveColor('0F') + setMidiCommandColor('3E') + initMidi() }}>