Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@

<title>Leaflet rotated marker example</title>

<link rel="stylesheet" href="https://cdn.leafletjs.com/leaflet/v1.1.0/leaflet.css" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
<style>
* { margin: 0; padding: 0; }
html, body { height: 100%; }
#map { width:100%; height:100%; }
</style>

<script src="https://cdn.leafletjs.com/leaflet/v1.1.0/leaflet-src.js"></script>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
<script src="leaflet.rotatedMarker.js"></script>
<script>
window.onload = function() {
Expand Down
3 changes: 2 additions & 1 deletion leaflet.rotatedMarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
var iconOptions = this.options.icon && this.options.icon.options;
var iconAnchor = iconOptions && this.options.icon.options.iconAnchor;
if (iconAnchor) {
iconAnchor = (iconAnchor[0] + 'px ' + iconAnchor[1] + 'px');
iconAnchor = L.point(iconAnchor);
iconAnchor = (iconAnchor.x + 'px ' + iconAnchor.y + 'px');
}
this.options.rotationOrigin = this.options.rotationOrigin || iconAnchor || 'center bottom' ;
this.options.rotationAngle = this.options.rotationAngle || 0;
Expand Down