Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image Editor is not resizing just after image is loaded. #601

Open
Silver-IT opened this issue May 28, 2021 · 2 comments
Open

Image Editor is not resizing just after image is loaded. #601

Silver-IT opened this issue May 28, 2021 · 2 comments
Labels

Comments

@Silver-IT
Copy link

Describe the bug
The size of imageEditor is not updated when we load new image.
It is same on both cases;

  1. when we load image using includeUI option.
  2. when we load image using Load button

Expected behavior
As soon as the new image is loaded, it will call the resizeEditor function sending imageSize attribute and the expected behavior is to update size of ImageEditor according to the new image size passed by imageSize attribute.

Gazing the code

resizeEditor({ uiSize, imageSize = this.imageSize } = {}) {
    if (imageSize !== this.imageSize) {
      this.imageSize = imageSize;
    }
    if (uiSize) {
      this._setUiSize(uiSize);
    }
    ...
}

this.imageSize variable is updated to passed imageSize attribute but it isn't used in any places.
Which means that the size of the newly-loaded image is not doing anything to update the size of imageEditor.

Additional context
This is one of priority and critical bug and needs to be fixed soon in my point of view.

@Silver-IT Silver-IT added the Bug label May 28, 2021
@lja1018
Copy link
Contributor

lja1018 commented Jun 2, 2021

@Silver-IT
Thank you for your report.
I will resolve it after checking.

@arimus
Copy link

arimus commented Nov 16, 2021

Not sure if my issue is related to this or not. I also get the image dimensions in the resize control not updating after the first load (load a different image after the first and the control doesn't update).

However, more importantly, it also appears that most of the time images can't be resized at all. Adjusting the slider causes the value to go to NaN and the resize is then broken. This may all be related to the way sizes are loading in and used. However, it appears that when I use my old resize hack (in the original resize feature request ticket), then the image load that I do appears to cause the resize controls to be fixed (and they continue to work for subsequently loaded images). Something about the initial image loading via the "Load" button that seems to be the likely culprit.

Notably, this second NaN bit happens when embedded the editor in my own project, however it does not happen when using the hosted example here: https://nhn.github.io/tui.image-editor/latest/tutorial-example01-includeUi

Happy to test any fixes / provide test images that I know break. Can create a new ticket if they turn out to not be related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants