Skip to content

Commit b0cfdc9

Browse files
feat(ui): do not sample alpha in Canvas color picker
Closes #7897
1 parent bb153b5 commit b0cfdc9

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

invokeai/frontend/web/src/features/controlLayers/konva/CanvasStateApiModule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export class CanvasStateApiModule extends CanvasModuleBase {
231231
/**
232232
* Sets the drawing color, pushing state to redux.
233233
*/
234-
setColor = (color: RgbaColor) => {
234+
setColor = (color: Partial<RgbaColor>) => {
235235
return this.store.dispatch(settingsColorChanged(color));
236236
};
237237

invokeai/frontend/web/src/features/controlLayers/konva/CanvasTool/CanvasColorPickerToolModule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ export class CanvasColorPickerToolModule extends CanvasModuleBase {
406406
};
407407

408408
onStagePointerUp = (_e: KonvaEventObject<PointerEvent>) => {
409-
const color = this.$colorUnderCursor.get();
410-
this.manager.stateApi.setColor({ ...color, a: color.a / 255 });
409+
const { a: _, ...color } = this.$colorUnderCursor.get();
410+
this.manager.stateApi.setColor(color);
411411
};
412412

413413
onStagePointerMove = (_e: KonvaEventObject<PointerEvent>) => {

invokeai/frontend/web/src/features/controlLayers/store/canvasSettingsSlice.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ const slice = createSlice({
134134
settingsEraserWidthChanged: (state, action: PayloadAction<CanvasSettingsState['eraserWidth']>) => {
135135
state.eraserWidth = Math.round(action.payload);
136136
},
137-
settingsColorChanged: (state, action: PayloadAction<CanvasSettingsState['color']>) => {
138-
state.color = action.payload;
137+
settingsColorChanged: (state, action: PayloadAction<Partial<CanvasSettingsState['color']>>) => {
138+
state.color = { ...state.color, ...action.payload };
139139
},
140140
settingsInvertScrollForToolWidthChanged: (
141141
state,

0 commit comments

Comments
 (0)