mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
Track various canvas states: - Filtering an entity - Transforming an entity - Rasterizing an entity - Compositing - Busy (derived from all of the above) Also track individual entity states: - Locked - Disabled - All of type are hidden - Has objects - Interactable (derived from all of the above) These states then gate various actions. For example: - Cannot invoke while the canvas is busy. - Cannot transform, filter, duplicate, or delete when the canvas is busy. Tool interaction restrictions are not yet implemented.
17 lines
529 B
TypeScript
17 lines
529 B
TypeScript
import { useStore } from '@nanostores/react';
|
|
import { useCanvasManager } from 'features/controlLayers/contexts/CanvasManagerProviderGate';
|
|
|
|
export const useCanvasIsBusy = () => {
|
|
const canvasManager = useCanvasManager();
|
|
/**
|
|
* Whether the canvas is busy:
|
|
* - While staging
|
|
* - While an entity is transforming
|
|
* - While an entity is filtering
|
|
* - While the canvas is doing some other long-running operation, like rasterizing a layer
|
|
*/
|
|
const isBusy = useStore(canvasManager.$isBusy);
|
|
|
|
return isBusy;
|
|
};
|