tui.image-editor
tui.image-editor copied to clipboard
Image Editor is not resizing just after image is loaded.
Describe the bug The size of imageEditor is not updated when we load new image. It is same on both cases;
- when we load image using includeUI option.
- 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 Thank you for your report. I will resolve it after checking.
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.