-
Notifications
You must be signed in to change notification settings - Fork 286
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
images distort while scaling #85
Comments
I've a couple of observations on this. Using OSX and chrome I can reliably reproduce this on the example by: Grabbing the top right handle and slowly dragging directly upwards you can create trapezoid distortion: By grabbing the top left handle and slowly dragging to the left you can stretch the image horizontally: And by grabbing any handle and very slowly rotating in either direction you can induce a little of both. Another thing to point out is the geographic size plays no role. It behaves the same big or small. Here is where it gets interesting. When I was writing the react wrapper I found myself wanting to make small changes to either scale or rotate and the results were not what I was looking for so I split them into two seperate actions. The problem with the distortion was completely eliminated and personally I found it easier to use. Might want to discuss with your users about changing core functionality like that but it will certainly eliminate the problem. Anyway, the heart of the problem is here: https://github.com/publiclab/Leaflet.DistortableImage/blob/master/src/edit/RotateHandle.js#L19-L20 This answer suggests scaling first then rotating which would be a cheap idea to try. Another option would be to combine the matrix transformations as outlined here. The theory is that the Third idea would be to put a threshold on the calculations or clamp them with |
This is really great research, thank you so much! I like your proposed solution of using I mentioned in #105 but we might also have an options flag to switch between a separate vs. combined scale/rotate interface. This could solve the issue for lots of people and I'd happily accept a PR or work towards this goal and would love to support if anyone's interested. |
@jywarren @ChrisLowe-Takor I have been working in this library for a bit now and just wanted to give an update on this issue! I think the problem was because we were applying transformations on the images assuming they are squares, but really they don't have the same height and width (difference of around 150px). By setting Please let me know if you have any thoughts on this! |
Amazing!!! So great!!!! 🎉🎉🎉🎉🎉
…On Tue, Mar 19, 2019, 11:23 AM Sasha Boginsky ***@***.***> wrote:
@jywarren <https://github.com/jywarren> @ChrisLowe-Takor
<https://github.com/ChrisLowe-Takor> I have been working in this library
for a bit now and just wanted to give an update on this issue! I think the
problem was because we were applying transformations on the images assuming
they are squares, but really they don't have the same height and width
(difference of around 150px). By setting edgeMinWidth and edgeMinHeight
options equal to their w/h when instantiating them and adding some
conditional logic in the scaling class, scaling no longer creates
distortions:
[image: bug5]
<https://user-images.githubusercontent.com/41092741/54618212-06409d80-4a39-11e9-8684-cdcbfa1bdefa.gif>
Please let me know if you have any thoughts on this!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#85 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJ9Wnwdgl7yl5vuBJJgf9m1go6YHSks5vYQDFgaJpZM4RlHSj>
.
|
@jywarren @ChrisLowe-Takor Ok take 2 -- this is now actually fixed! via #341 and #348. The solution was to switch Should I close this an open a new issue for that? |
via @patcoyle in publiclab/mapknitter#195 - copying this over!
Plus LOTS of detailed info on this bug over here: publiclab/mapknitter#153
See attached screenshot of in-progress map: http://mapknitter.org/maps/livermore-ca-mobius-with-8mm-lens
Image at bottom right is example where when attempting to scale, size, or rotate, the image distorts. Sometimes, to trapezoidal shape, sometimes "squashed" or stretched in one dimension.
http://mapknitter.org/maps/livermore-ca-mobius-with-8mm-lens
your PublicLab.org username (if you have one): patcoyle
describe how urgent the problem is (desperate or just-trying-to-help!): Mapknitter is mainline tool, so if systemic, urgent.
If you are able, it may also help to quickly resolve the issue if you:
The text was updated successfully, but these errors were encountered: