-
Notifications
You must be signed in to change notification settings - Fork 8
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
Lock aspect ratio when image grows larger than editor #5
Comments
The default If you need to change the aspect ratio handling during user edits you can always create a If you need to force an aspect ratio for some image, one option is to initialize the editor with an |
@xeger Thank you for your answer. No, it's not broken. The aspect ratio is only not preserved when the image is stretched beyond the editor's boundary. I was expecting it to be preserved at all cases. |
OIC ... I'm not sure how to fix that, actually! I would need to play with it a bit and understand what the browser is doing to constrain the aspect ratio, when it grows outside the boundary. |
@mkamalkayani it seems that the browser's layout engine is constraining the width of the image. Notice that the HTML attribute is set to the correct width (should be ~1500px wide because I dragged the mouse very far right) -- but somehow the image is being constrained by its parent My CSS skills are poor, so I'm not 100% sure how to fix this. I tried adding I notice that if I make the image too big, then shrink it, the aspect ratio is distorted. That is annoying & is probably a bug I could fix. Is that the bug you were originally complaining about? |
This is easily encountered when you drag the upper-left resize handle to the left, increasing the image to sizes larger than the editor, or by resizing the editor itself to take on small dimensions. A somewhat orthogonal feature may incidentally address this however: Being able to restore the original image size. While it would be great if image distortion would be prevented in the first place, restoring the original image dimensions would be a nice-to-have on its own and could be implemented by "forgetting" the height/width properties in the Delta, no? |
Yup; a command could be added to forget the delta's height and width. To prevent distortion, the trick would be for the image-resizer to remember the original aspect ratio on click, and during the drag events, stop resizing if it would result in the ratio becoming distorted. It's easy in principle to do, and at some point I will get around to it (famous last words). |
I have also encountered this issue, and I hope to reach the maximum width or height when zooming in, instead of changing the aspect ratio |
Is it possible to lock the aspect ratio of the image?
The text was updated successfully, but these errors were encountered: