-
-
Notifications
You must be signed in to change notification settings - Fork 866
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
[v2.2.0] Add Rotation Capability To OverlayImage
#1315
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, and thanks for your contribution!
Whilst testing, it seems to work well, except I'm confused about which points are transformed. For example, see this image, when there is no rotationPoint
defined:
As far as I understand, the red point should be the top-left, and the blue should be in the bottom-right? When I add the rotationPoint
, it looks correct to me:
Can you just confirm the behaviour a bit more? Maybe the point above is the intended functioning, but I'm not sure.
OverlayImage
Thanks for the fast reply. I'm looking into this. |
No problem. Just note that it wasn't the bottom image that was the issue to me (you can't stretch the image, and it looks like the vertical offset from corner to marker averages to 0 on both left and right, which is correct), it was that the top image should have the markers swapped vertically on the corners, if you get what I mean. |
Actually I can stretch/skew the image so all 3 points are aligned correctly. It worked, but when cleaning up the code I must have changed something.. This is how it is supposed to work: http://ivansanchez.github.io/Leaflet.ImageOverlay.Rotated/demo.html
I basically haven't touched the code that handles the positioning of the image when there is no |
I'm not 100% sure I like this (the way the demo works). I think we should have a parameter that toggles skewing, where disabled is like the way it works currently, and enabled is the way the demo site works.
Hmm, that's quite weird then. Maybe the example coords are just specified wrong. I wouldn't worry about it in this case. |
Just reading up on this...looks ok when I test, but haven't had chance to dig much...what's with the misaligned marker points above ? |
@Robbendebiene As v2.1.0 is now ready to merge and release, I'll have to leave this PR for the next release. |
OverlayImage
OverlayImage
This is done to solve a problem for the rotated image caused by the LatLngBounds class which may swap corner point lat/lngs.
I've finally figured out why sometimes the corner points of the image correctly align with the markers/provided lat lng points and sometimes not. I decided not to create an extra layer and instead created another |
Ah I see. Can't test right now, but should be able to soon. Maybe creating a separate class is the best option anyway, good choice! |
OverlayImage
OverlayImage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, seems good to me.
Thanks for your contributions! |
Currently the OverlayImage layer only accepts a rectengular bounding box based on two corner points.
This doesn't allow rotating overlaid images like it is possible in other map frameworks.
Mapbox for example requires a latitude/longitude for each corner of the image.
For Leaflet the following plugin/layer exists which just requires 3 points to be defined (because it derives the 4th point itself): https://github.com/IvanSanchez/Leaflet.ImageOverlay.Rotated
This PR is based on the beforehand mentioned
Leaflet.ImageOverlay.Rotated
layer and adds a third point to rotate/skew the image.