Skip to content

Commit

Permalink
feat(ui): better warnings when transforming
Browse files Browse the repository at this point in the history
  • Loading branch information
psychedelicious authored and hipsterusername committed Oct 15, 2024
1 parent 804ee3a commit 1251dfd
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
*/
fitToBboxFill = () => {
if (!this.$isTransformEnabled.get()) {
this.log.warn('Cannot fit to bbox contain when transform is disabled');
this.log.warn(
'Cannot fit to bbox contain when transform is disabled. Did you forget to call `await adapter.transformer.startTransform()`?'
);
return;
}
const { rect } = this.manager.stateApi.getBbox();
Expand All @@ -428,7 +430,9 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
*/
fitToBboxContain = () => {
if (!this.$isTransformEnabled.get()) {
this.log.warn('Cannot fit to bbox contain when transform is disabled');
this.log.warn(
'Cannot fit to bbox contain when transform is disabled. Did you forget to call `await adapter.transformer.startTransform()`?'
);
return;
}
const { rect } = this.manager.stateApi.getBbox();
Expand Down Expand Up @@ -460,7 +464,9 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
*/
fitToBboxCover = () => {
if (!this.$isTransformEnabled.get()) {
this.log.warn('Cannot fit to bbox contain when transform is disabled');
this.log.warn(
'Cannot fit to bbox contain when transform is disabled. Did you forget to call `await adapter.transformer.startTransform()`?'
);
return;
}
const { rect } = this.manager.stateApi.getBbox();
Expand Down Expand Up @@ -687,6 +693,12 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
* Applies the transformation of the entity.
*/
applyTransform = async () => {
if (!this.$isTransforming.get()) {
this.log.warn(
'Cannot apply transform when not transforming. Did you forget to call `await adapter.transformer.startTransform()`?'
);
return;
}
this.log.debug('Applying transform');
this.$isProcessing.set(true);
this._setInteractionMode('off');
Expand Down

0 comments on commit 1251dfd

Please sign in to comment.