Skip to content

Commit

Permalink
L.Symbol.arrowHead: Enable option angleCorrection (similar to bbecque…
Browse files Browse the repository at this point in the history
  • Loading branch information
plepe committed Sep 23, 2018
1 parent 96858e8 commit 62bf0c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dist/leaflet.polylineDecorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ L$1.Symbol.ArrowHead = L$1.Class.extend({
polygon: true,
pixelSize: 10,
headAngle: 60,
angleCorrection: 0,
pathOptions: {
stroke: false,
weight: 2
Expand All @@ -244,7 +245,7 @@ L$1.Symbol.ArrowHead = L$1.Class.extend({
_buildArrowPath: function _buildArrowPath(dirPoint, map) {
var d2r = Math.PI / 180;
var tipPoint = map.project(dirPoint.latLng);
var direction = -(dirPoint.heading - 90) * d2r;
var direction = -(dirPoint.heading - 90 + this.options.angleCorrection) * d2r;
var radianArrowAngle = this.options.headAngle / 2 * d2r;

var headAngle1 = direction + radianArrowAngle;
Expand Down
3 changes: 2 additions & 1 deletion src/L.Symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ L.Symbol.ArrowHead = L.Class.extend({
polygon: true,
pixelSize: 10,
headAngle: 60,
angleCorrection: 0,
pathOptions: {
stroke: false,
weight: 2
Expand All @@ -74,7 +75,7 @@ L.Symbol.ArrowHead = L.Class.extend({
_buildArrowPath: function (dirPoint, map) {
const d2r = Math.PI / 180;
const tipPoint = map.project(dirPoint.latLng);
const direction = (-(dirPoint.heading - 90)) * d2r;
const direction = (-(dirPoint.heading - 90 + this.options.angleCorrection)) * d2r;
const radianArrowAngle = this.options.headAngle / 2 * d2r;

const headAngle1 = direction + radianArrowAngle;
Expand Down

0 comments on commit 62bf0c1

Please sign in to comment.