Skip to content

Commit 1251dfd

Browse files
psychedelicioushipsterusername
authored andcommitted
feat(ui): better warnings when transforming
1 parent 804ee3a commit 1251dfd

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

invokeai/frontend/web/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,9 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
407407
*/
408408
fitToBboxFill = () => {
409409
if (!this.$isTransformEnabled.get()) {
410-
this.log.warn('Cannot fit to bbox contain when transform is disabled');
410+
this.log.warn(
411+
'Cannot fit to bbox contain when transform is disabled. Did you forget to call `await adapter.transformer.startTransform()`?'
412+
);
411413
return;
412414
}
413415
const { rect } = this.manager.stateApi.getBbox();
@@ -428,7 +430,9 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
428430
*/
429431
fitToBboxContain = () => {
430432
if (!this.$isTransformEnabled.get()) {
431-
this.log.warn('Cannot fit to bbox contain when transform is disabled');
433+
this.log.warn(
434+
'Cannot fit to bbox contain when transform is disabled. Did you forget to call `await adapter.transformer.startTransform()`?'
435+
);
432436
return;
433437
}
434438
const { rect } = this.manager.stateApi.getBbox();
@@ -460,7 +464,9 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
460464
*/
461465
fitToBboxCover = () => {
462466
if (!this.$isTransformEnabled.get()) {
463-
this.log.warn('Cannot fit to bbox contain when transform is disabled');
467+
this.log.warn(
468+
'Cannot fit to bbox contain when transform is disabled. Did you forget to call `await adapter.transformer.startTransform()`?'
469+
);
464470
return;
465471
}
466472
const { rect } = this.manager.stateApi.getBbox();
@@ -687,6 +693,12 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
687693
* Applies the transformation of the entity.
688694
*/
689695
applyTransform = async () => {
696+
if (!this.$isTransforming.get()) {
697+
this.log.warn(
698+
'Cannot apply transform when not transforming. Did you forget to call `await adapter.transformer.startTransform()`?'
699+
);
700+
return;
701+
}
690702
this.log.debug('Applying transform');
691703
this.$isProcessing.set(true);
692704
this._setInteractionMode('off');

0 commit comments

Comments
 (0)