Skip to content

Commit

Permalink
fix(cloud-editor): refetch image on container resize
Browse files Browse the repository at this point in the history
  • Loading branch information
nd0ut committed Mar 10, 2023
1 parent 5686965 commit 67ea66f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions blocks/CloudImageEditor/src/EditorImageCropper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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();
}
});
Expand Down

0 comments on commit 67ea66f

Please sign in to comment.