Skip to content
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

Fix angulation of distance markers's arrows when preferCanvas: false #207

Merged
merged 2 commits into from
Nov 18, 2022

Conversation

makenshikuro
Copy link
Contributor

Removed RAD to DEG angle

When calculating the slope with atan2 the degrees are obtained.
I guess you don't need to transform RAD to DEG.
I changed it and everything works perfectly.

Can you verify?

Removed RAD to DEG angle
Copy link
Owner

@Raruto Raruto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @makenshikuro,

are you trying to fix a bug? if so, can you also attach a couple of self-explanatory pictures showing the before / after? (also a demo wouldn't hurt).

@@ -206,7 +206,7 @@ L.DistanceMarkers = L.LayerGroup.extend({
iconSize: options.arrowSize,
}),
// NB the following option is added by "leaflet-rotate"
rotation: angle * L.DomUtil.RAD_TO_DEG,
rotation: angle,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// NB the following option is added by "leaflet-rotate"
rotation: angle * L.DomUtil.RAD_TO_DEG,

Before I get into the code, did you notice the comment above? (that is: are you including this library as well? Raruto/leaflet-rotate)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Raruto.
Sorry for long time.
In this moment don't remember if i put the library ( i would want say yes but i'm not sure),
I will open the project and inspect it a second time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've visited some of your demo about leaflet-elevation and the arrows don't show the correct direction way.
For example: leaflet-elevation/i18n-strings or
leaflet-elevation/dynamic-runner the arrows point incorrectly or so I think.
With this change, the arrows point the correct direction in every moment.
RouteMap for University of Valencia

Answering you about the library Raruto/leaflet-rotate. No, I tried to use in my first attempt but I didn't need rotate all map. Anyway, the demos of leaflet-elevation don't use the library leaflet-rotate and the arrows point to the wrong direction. Maybe I'm doing something wrong?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@makenshikuro just to know, arrows are shown correctly if instead you set preferCanvas: true?

Ref: https://leafletjs.com/reference.html#map-prefercanvas

@Raruto Raruto changed the title Fixed angle of arrow markers Fix angulation of distance markers's arrows when preferCanvas: false Nov 18, 2022
@Raruto Raruto merged commit b591718 into Raruto:master Nov 18, 2022
@Raruto
Copy link
Owner

Raruto commented Dec 18, 2022

Patch released in version 2.2.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants