# leaflet-rotatedmarker

> Enables rotation of marker icons in Leaflet.

Latest version **0.2.0** (published 2017-06-28) · MIT license · 62.7K weekly downloads

## Install

```sh
npm install leaflet-rotatedmarker
pnpm add leaflet-rotatedmarker
yarn add leaflet-rotatedmarker
bun add leaflet-rotatedmarker
```

## Health

**Score 28/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities.

Warnings: no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2017-06-28 |
| First published | 2016-03-13 |
| Weekly downloads | 62.7K |
| License | MIT |
| TypeScript types | separate (@types/leaflet-rotatedmarker) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 274 |
| Author | Benjamin Becquet |
| Maintainers | bbecquet |

## Links

- npm: https://www.npmjs.com/package/leaflet-rotatedmarker
- Repository: https://github.com/bbecquet/Leaflet.RotatedMarker
- Homepage: https://github.com/bbecquet/Leaflet.RotatedMarker#readme
- Issues: https://github.com/bbecquet/Leaflet.RotatedMarker/issues
- npm.io page: https://npm.io/package/leaflet-rotatedmarker

## Recent versions

- 0.2.0 (latest) — 2017-06-28
- 0.1.2 — 2016-11-11
- 0.1.1 — 2016-09-30
- 0.1.0 — 2016-03-13

## README

Leaflet Rotated Marker
===

Enables rotation of marker icons in Leaflet.

Compatible with versions 0.7.* and 1.* of Leaflet. Doesn't work on IE < 9.

```bash
npm install leaflet-rotatedmarker
```

Usage
---

```js
L.marker([48.8631169, 2.3708919], {
    rotationAngle: 45
}).addTo(map);
```

API
---

It simply extends the `L.Marker` class with two new options:

Option | Type | Default | Description  
-------|------|---------|------------
**`rotationAngle`** | `Number` | 0 | Rotation angle, in degrees, clockwise.
**`rotationOrigin`** | `String` | `'bottom center'` | The rotation center, as a [`transform-origin`](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin) CSS rule.

and two new methods:

Method | Returns | Description
-------|---------|------------
**`setRotationAngle(newAngle)`** | `this` | Sets the rotation angle value.
**`setRotationOrigin(newOrigin)`** | `this` | Sets the rotation origin value.

The default `rotationOrigin` value will rotate around the bottom center point, corresponding to the "tip" of the marker for most commonly used icons. If your marker icon has no tip, or you want to rotate around its center, use `center center`.

Note
---

On purpose, it doesn't rotate marker icon shadows. Mainly because there is no way to make it look good with the perspective of classic, pin type shadows (anyway, these shadows are so 2005, right?).

So just disable icon shadows, or use simple ones which will work for all marker angles.

---
_Source: https://npm.io/package/leaflet-rotatedmarker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
