-
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
Can't scale things down, only up #320
Comments
Hi, @steviepubliclab and myself have just experienced this same bug on https://mapknitter.org/maps/the-warehouse-bywater . Cannot scale down. (Can distort to make something smaller as a last resort) |
I believe this will be solved in Leaflet.DistortableImage 0.5.0 which is slated to be published later today. But in case not, noting that this bug seems to only affect some images - this map for example doesn't show it: https://mapknitter.org/maps/cranston-test |
@jywarren @ebarry This is really exciting I managed to replicate this bug in LDI and I think it is a big realization about an implementation detail that we were confused about before:
So the answer to #219 - what is ideal |
oh wow, what an obscure issue! Is there a short-term fix that gets basic scaling working again, with the more subtle projection issues solvable in a follow-up? Thanks Sasha! |
Leaflet.DistortableImage/src/edit/RotateScaleHandle.js Lines 26 to 32 in 83e3371
|
So in that section we should convert
|
var corner1 = map.latLngToContainerPoint(overlay.getCorner(0)),
corner2 = map.latLngToContainerPoint(overlay.getCorner(1)),
w, h;
w = Math.abs(corner1.x - corner2.x);
h = Math.abs(corner1.y - corner2.y); |
And, |
couldn't get this to work. Noting other solutions i'm thinking to try next / just notes -
@jywarren what are your thoughts? |
Hmm, I'm going to look at this error:
first! |
OK, i think i got it. Basically it's working, but when we do this comparison |
so: var w = Math.abs(corner1.x - corner2.x);
var h = Math.abs(corner1.y - corner2.y);
var distance = Math.srqt(w * w + h * h); |
See #340! |
You can still brute-force it somehow... spinning around until you can get it to run. And there are some distortion issues happening. But I think bumping the min value to 30px can be a relatively good fix. |
You can get past it if you are scaling really fast, like, if the change in scale is close to 50px change per animation frame, but it's pretty tough. |
Confirmed thsi is fixed and published to MapKnitter! Thanks all! |
In MapKnitter now, on this map, i'm using the "r" key to switch to rotate+scale, but can only seem to scale up, not down: https://mapknitter.org/maps/irish-uk-border-mapping/
As this is in production, I'm marking it as priority -- let's try to pin this down! 🙌
The text was updated successfully, but these errors were encountered: