diff --git a/blocks/CloudImageEditor/src/EditorImageCropper.js b/blocks/CloudImageEditor/src/EditorImageCropper.js index 50f752606..abd4cf1f2 100644 --- a/blocks/CloudImageEditor/src/EditorImageCropper.js +++ b/blocks/CloudImageEditor/src/EditorImageCropper.js @@ -93,10 +93,8 @@ export class EditorImageCropper extends Block { if (!this.isConnected) { return; } - this._initCanvas(); - this._alignImage(); - this._alignCrop(); - this._draw(); + this.deactivate(); + this.activate(this._imageSize, { fromViewer: false }); } /** @private */ @@ -493,8 +491,9 @@ export class EditorImageCropper extends Block { initCallback() { super.initCallback(); - this._observer = new ResizeObserver(() => { - if (this._isActive && this.$.image) { + this._observer = new ResizeObserver(([entry]) => { + const nonZeroSize = entry.contentRect.width > 0 && entry.contentRect.height > 0; + if (nonZeroSize && this._isActive && this.$.image) { this._handleResizeDebounced(); } });