mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 17:58:55 +00:00
Add paint color signal events
This commit is contained in:
1 parent
54261d86da
commit
67a5ea44c1
2 files changed
+23
No files matched your search
@@ -3,11 +3,14 @@ import {
|
||||
loadingBarRetryDispatch,
|
||||
loadingBarRetryEventHandler,
|
||||
} from "./loadingBar";
|
||||
import { onPaintColorChanged, setPaintColor } from "./paintMode";
|
||||
export const dispatchers = {
|
||||
...buttonDispatchers,
|
||||
loadingBarRetry: loadingBarRetryDispatch,
|
||||
setPaintColor,
|
||||
};
|
||||
export const eventsHandlers = {
|
||||
...buttonEventsHandlers,
|
||||
loadingBarRetry: loadingBarRetryEventHandler,
|
||||
onPaintColorChanged
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
// Prompt settings
|
||||
// - Prompt text
|
||||
|
||||
import { effect, signal } from "@preact/signals-react";
|
||||
|
||||
// - Prompt strength
|
||||
export const DEFAULT_PAINT_COLOR: string = "#000000";
|
||||
export const paintColor = signal<string>(DEFAULT_PAINT_COLOR);
|
||||
export const setPaintColor = (data: string) => {
|
||||
paintColor.value = data;
|
||||
};
|
||||
|
||||
export const onPaintColorChanged = (callback: (data: string) => void) => {
|
||||
effect(() => {
|
||||
if (paintColor.value) {
|
||||
callback(paintColor.value);
|
||||
}
|
||||
});
|
||||
};
|
||||
Reference in new issue
Block a user