mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
feat(ui): add bookmark for quick switch
This commit is contained in:
@@ -84,6 +84,7 @@ const getRGMaskFill = (state: CanvasState): RgbColor => {
|
||||
const initialState: CanvasState = {
|
||||
_version: 3,
|
||||
selectedEntityIdentifier: null,
|
||||
quickSwitchEntityIdentifier: null,
|
||||
rasterLayers: {
|
||||
isHidden: false,
|
||||
entities: [],
|
||||
@@ -791,6 +792,22 @@ export const canvasSlice = createSlice({
|
||||
}
|
||||
state.selectedEntityIdentifier = entityIdentifier;
|
||||
},
|
||||
entityIsBookmarkedForQuickSwitchChanged: (
|
||||
state,
|
||||
action: PayloadAction<{ entityIdentifier: CanvasEntityIdentifier | null }>
|
||||
) => {
|
||||
const { entityIdentifier } = action.payload;
|
||||
if (!entityIdentifier) {
|
||||
state.quickSwitchEntityIdentifier = null;
|
||||
return;
|
||||
}
|
||||
const entity = selectEntity(state, entityIdentifier);
|
||||
if (!entity) {
|
||||
// Cannot select a non-existent entity
|
||||
return;
|
||||
}
|
||||
state.quickSwitchEntityIdentifier = entityIdentifier;
|
||||
},
|
||||
entityNameChanged: (state, action: PayloadAction<EntityIdentifierPayload<{ name: string | null }>>) => {
|
||||
const { entityIdentifier, name } = action.payload;
|
||||
const entity = selectEntity(state, entityIdentifier);
|
||||
@@ -1105,6 +1122,7 @@ export const {
|
||||
canvasClearHistory,
|
||||
// All entities
|
||||
entitySelected,
|
||||
entityIsBookmarkedForQuickSwitchChanged,
|
||||
entityNameChanged,
|
||||
entityReset,
|
||||
entityIsEnabledToggled,
|
||||
|
||||
@@ -181,6 +181,11 @@ export const selectSelectedEntityIdentifier = createSelector(
|
||||
(canvas) => canvas.selectedEntityIdentifier
|
||||
);
|
||||
|
||||
export const selectQuickSwitchEntityIdentifier = createSelector(
|
||||
selectCanvasSlice,
|
||||
(canvas) => canvas.quickSwitchEntityIdentifier
|
||||
);
|
||||
|
||||
export const selectIsSelectedEntityDrawable = createSelector(
|
||||
selectSelectedEntityIdentifier,
|
||||
(selectedEntityIdentifier) => {
|
||||
|
||||
@@ -688,6 +688,7 @@ export type StagingAreaImage = {
|
||||
export type CanvasState = {
|
||||
_version: 3;
|
||||
selectedEntityIdentifier: CanvasEntityIdentifier | null;
|
||||
quickSwitchEntityIdentifier: CanvasEntityIdentifier | null;
|
||||
inpaintMasks: {
|
||||
isHidden: boolean;
|
||||
entities: CanvasInpaintMaskState[];
|
||||
|
||||
Reference in New Issue
Block a user