mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
feat(ui): disable filter apply button when no filter processed
This commit is contained in:
@@ -20,6 +20,7 @@ const FilterBox = memo(({ adapter }: { adapter: CanvasEntityAdapterRasterLayer |
|
||||
const dispatch = useAppDispatch();
|
||||
const config = useStore(adapter.filterer.$filterConfig);
|
||||
const isProcessing = useStore(adapter.filterer.$isProcessing);
|
||||
const hasProcessed = useStore(adapter.filterer.$hasProcessed);
|
||||
const autoProcessFilter = useAppSelector(selectAutoProcessFilter);
|
||||
|
||||
const onChangeFilterConfig = useCallback(
|
||||
@@ -96,7 +97,7 @@ const FilterBox = memo(({ adapter }: { adapter: CanvasEntityAdapterRasterLayer |
|
||||
onClick={adapter.filterer.apply}
|
||||
isLoading={isProcessing}
|
||||
loadingText={t('controlLayers.filter.apply')}
|
||||
isDisabled={!isValid}
|
||||
isDisabled={!isValid || !hasProcessed}
|
||||
>
|
||||
{t('controlLayers.filter.apply')}
|
||||
</Button>
|
||||
|
||||
@@ -26,6 +26,7 @@ export class CanvasEntityFilterer extends CanvasModuleBase {
|
||||
subscriptions = new Set<() => void>();
|
||||
|
||||
$isFiltering = atom<boolean>(false);
|
||||
$hasProcessed = atom<boolean>(false);
|
||||
$isProcessing = atom<boolean>(false);
|
||||
$filterConfig = atom<FilterConfig>(IMAGE_FILTERS.canny_image_processor.buildDefaults());
|
||||
|
||||
@@ -102,6 +103,7 @@ export class CanvasEntityFilterer extends CanvasModuleBase {
|
||||
|
||||
this.parent.renderer.hideObjects();
|
||||
this.$isProcessing.set(false);
|
||||
this.$hasProcessed.set(true);
|
||||
};
|
||||
|
||||
this.manager.socket.on('invocation_complete', listener);
|
||||
@@ -137,6 +139,7 @@ export class CanvasEntityFilterer extends CanvasModuleBase {
|
||||
});
|
||||
this.imageState = null;
|
||||
this.$isFiltering.set(false);
|
||||
this.$hasProcessed.set(false);
|
||||
this.manager.stateApi.$filteringAdapter.set(null);
|
||||
};
|
||||
|
||||
@@ -148,6 +151,7 @@ export class CanvasEntityFilterer extends CanvasModuleBase {
|
||||
this.parent.transformer.updatePosition();
|
||||
this.parent.renderer.syncCache(true);
|
||||
this.imageState = null;
|
||||
this.$hasProcessed.set(false);
|
||||
};
|
||||
|
||||
cancel = () => {
|
||||
@@ -156,6 +160,7 @@ export class CanvasEntityFilterer extends CanvasModuleBase {
|
||||
this.reset();
|
||||
this.$isProcessing.set(false);
|
||||
this.$isFiltering.set(false);
|
||||
this.$hasProcessed.set(false);
|
||||
this.manager.stateApi.$filteringAdapter.set(null);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user