mirror of
https://github.com/meowarex/TidaLuna-Plugins.git
synced 2026-06-18 03:43:10 +10:00
Fixed Some Issues
This commit is contained in:
@@ -52,13 +52,24 @@ export const Settings = () => {
|
|||||||
setBarColor(color);
|
setBarColor(color);
|
||||||
setCustomInput(color);
|
setCustomInput(color);
|
||||||
settings.barColor = color;
|
settings.barColor = color;
|
||||||
|
(window as any).updateAudioVisualizer?.();
|
||||||
};
|
};
|
||||||
|
|
||||||
const addCustomColor = () => {
|
const addCustomColor = () => {
|
||||||
if (customInput && !colorPresets.includes(customInput) && !customColors.includes(customInput)) {
|
if (customInput) {
|
||||||
const newCustomColors = [...customColors, customInput];
|
// Trim whitespace and convert to lowercase
|
||||||
setCustomColors(newCustomColors);
|
const trimmedInput = customInput.trim().toLowerCase();
|
||||||
settings.customColors = newCustomColors;
|
|
||||||
|
// Validate hex color format
|
||||||
|
const hexColorRegex = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i;
|
||||||
|
|
||||||
|
if (hexColorRegex.test(trimmedInput) &&
|
||||||
|
!colorPresets.includes(trimmedInput) &&
|
||||||
|
!customColors.includes(trimmedInput)) {
|
||||||
|
const newCustomColors = [...customColors, trimmedInput];
|
||||||
|
setCustomColors(newCustomColors);
|
||||||
|
settings.customColors = newCustomColors;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,6 +95,7 @@ export const Settings = () => {
|
|||||||
onChange={(_, checked) => {
|
onChange={(_, checked) => {
|
||||||
setBarRounding(checked);
|
setBarRounding(checked);
|
||||||
settings.barRounding = checked;
|
settings.barRounding = checked;
|
||||||
|
(window as any).updateAudioVisualizer?.();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -97,6 +109,7 @@ export const Settings = () => {
|
|||||||
onNumber={(value: number) => {
|
onNumber={(value: number) => {
|
||||||
setBarCount(value);
|
setBarCount(value);
|
||||||
settings.barCount = value;
|
settings.barCount = value;
|
||||||
|
(window as any).updateAudioVisualizer?.();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -390,9 +390,7 @@ const updateAudioVisualizer = (): void => {
|
|||||||
// use a fixed size that provides enough frequency bins
|
// use a fixed size that provides enough frequency bins
|
||||||
analyser.fftSize = 512; // Fixed power of 2 - important
|
analyser.fftSize = 512; // Fixed power of 2 - important
|
||||||
analyser.smoothingTimeConstant = config.smoothing;
|
analyser.smoothingTimeConstant = config.smoothing;
|
||||||
if (dataArray) {
|
dataArray = new Uint8Array(analyser.frequencyBinCount);
|
||||||
dataArray = new Uint8Array(analyser.frequencyBinCount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canvas) {
|
if (canvas) {
|
||||||
|
|||||||
Reference in New Issue
Block a user