Open HodellersHedge opened 4 years ago
the same question
same here.
And for non custom Icons I cannot get it to work either.
If it not work, how do I rotate the icon, please ?
I ended up creating 32 icons, each one with a different rotation angle, and loading the one closest to the angle needed. Not the most elegant solution but works...
anyone able to solve this? improve it?
Hi,
I am not familiar with this plugin, but the README says that it "extends the L.Marker
class with two new options", therefore I would simply expect the usage with custom icon to be:
L.marker(You, {
icon: greenIcon,
rotationAngle: 25,
rotationOrigin: [32, 33]
}).addTo(map);
whereas OP separated each option in a different argument:
L.marker(You, {
icon: greenIcon
}, {
rotationAngle: 25
}, {
rotationOrigin: [32, 33]
}).addTo(map);
Looks like that works... Thanks!
With the following code everything appears to work correctly:
var You = L.latLng([500, 500]);
L.marker(You, {rotationAngle: 25}, {rotationOrigin: [32, 33]}).addTo(map);
Now, by adding an icon and passing it as second argument, the rotationAngle appears to have no effect:
var You = L.latLng([500, 500]);
var greenIcon = L.icon({iconUrl: 'favicons/tarkov/Legend/green-icon.png'});
L.marker(You, {icon: greenIcon}, {rotationAngle: 25}, {rotationOrigin: [32, 33]}).addTo(map);
btw the green icon looks that way by default as png. it didnt rotate at all.