mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-01-15 02:58:15 -05:00
Merge branch 'main' into t2i_resolution_hack
This commit is contained in:
@@ -285,6 +285,10 @@ export abstract class CanvasEntityAdapterBase<
|
||||
this.subscriptions.add(
|
||||
this.manager.stateApi.createStoreSubscription(selectIsolatedLayerPreview, this.syncVisibility)
|
||||
);
|
||||
this.subscriptions.add(
|
||||
this.manager.stateApi.createStoreSubscription(selectIsolatedStagingPreview, this.syncVisibility)
|
||||
);
|
||||
this.subscriptions.add(this.manager.stateApi.createStoreSubscription(selectIsStaging, this.syncVisibility));
|
||||
this.subscriptions.add(this.manager.stateApi.$filteringAdapter.listen(this.syncVisibility));
|
||||
this.subscriptions.add(this.manager.stateApi.$transformingAdapter.listen(this.syncVisibility));
|
||||
this.subscriptions.add(this.manager.stateApi.$segmentingAdapter.listen(this.syncVisibility));
|
||||
|
||||
@@ -296,6 +296,14 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
|
||||
this.syncInteractionState();
|
||||
};
|
||||
|
||||
syncCursorStyle = () => {
|
||||
if (!this.parent.renderer.hasObjects()) {
|
||||
this.manager.stage.setCursor('not-allowed');
|
||||
} else {
|
||||
this.manager.stage.setCursor('default');
|
||||
}
|
||||
};
|
||||
|
||||
anchorStyleFunc = (anchor: Konva.Rect): void => {
|
||||
// Give the rotater special styling
|
||||
if (anchor.hasName('rotater')) {
|
||||
@@ -591,6 +599,13 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
|
||||
syncInteractionState = () => {
|
||||
this.log.trace('Syncing interaction state');
|
||||
|
||||
if (this.manager.stagingArea.$isStaging.get()) {
|
||||
// While staging, the layer should not be interactable
|
||||
this.parent.konva.layer.listening(false);
|
||||
this._setInteractionMode('off');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.parent.segmentAnything?.$isSegmenting.get()) {
|
||||
// When segmenting, the layer should listen but the transformer should not be interactable
|
||||
this.parent.konva.layer.listening(true);
|
||||
|
||||
@@ -59,7 +59,9 @@ export class CanvasProgressImageModule extends CanvasModuleBase {
|
||||
this.hasActiveGeneration = true;
|
||||
} else {
|
||||
this.hasActiveGeneration = false;
|
||||
this.$lastProgressEvent.set(null);
|
||||
if (!this.manager.stagingArea.$isStaging.get()) {
|
||||
this.$lastProgressEvent.set(null);
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
@@ -680,4 +680,20 @@ export class CanvasStateApiModule extends CanvasModuleBase {
|
||||
* Whether the shift key is currently pressed.
|
||||
*/
|
||||
$shiftKey = $shift;
|
||||
|
||||
repr = () => {
|
||||
return {
|
||||
id: this.id,
|
||||
type: this.type,
|
||||
path: this.path,
|
||||
$filteringAdapter: this.$filteringAdapter.get()?.entityIdentifier,
|
||||
$isFiltering: this.$isFiltering.get(),
|
||||
$transformingAdapter: this.$transformingAdapter.get()?.entityIdentifier,
|
||||
$isTransforming: this.$isTransforming.get(),
|
||||
$rasterizingAdapter: this.$rasterizingAdapter.get()?.entityIdentifier,
|
||||
$isRasterizing: this.$isRasterizing.get(),
|
||||
$segmentingAdapter: this.$segmentingAdapter.get()?.entityIdentifier,
|
||||
$isSegmenting: this.$isSegmenting.get(),
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import type { CanvasManager } from 'features/controlLayers/konva/CanvasManager';
|
||||
import { CanvasModuleBase } from 'features/controlLayers/konva/CanvasModuleBase';
|
||||
import type { CanvasToolModule } from 'features/controlLayers/konva/CanvasTool/CanvasToolModule';
|
||||
import { getPrefixedId } from 'features/controlLayers/konva/util';
|
||||
import { noop } from 'lodash-es';
|
||||
import type { Logger } from 'roarr';
|
||||
|
||||
export class CanvasMoveToolModule extends CanvasModuleBase {
|
||||
@@ -24,8 +23,13 @@ export class CanvasMoveToolModule extends CanvasModuleBase {
|
||||
this.log.debug('Creating module');
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a noop. Entity transformers handle cursor style when the move tool is active.
|
||||
*/
|
||||
syncCursorStyle = noop;
|
||||
syncCursorStyle = () => {
|
||||
const selectedEntity = this.manager.stateApi.getSelectedEntityAdapter();
|
||||
if (!selectedEntity) {
|
||||
this.manager.stage.setCursor('not-allowed');
|
||||
} else {
|
||||
// The cursor is on an entity, defer to transformer to handle the cursor
|
||||
selectedEntity.transformer.syncCursorStyle();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ export class CanvasToolModule extends CanvasModuleBase {
|
||||
} else if (segmentingAdapter) {
|
||||
segmentingAdapter.segmentAnything.syncCursorStyle();
|
||||
} else if (transformingAdapter) {
|
||||
// The transformer handles cursor style via events
|
||||
transformingAdapter.transformer.syncCursorStyle();
|
||||
} else if (this.manager.stateApi.$isFiltering.get()) {
|
||||
stage.setCursor('not-allowed');
|
||||
} else if (this.manager.stagingArea.$isStaging.get()) {
|
||||
|
||||
Reference in New Issue
Block a user