-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add triangle-down/triangle-up marker shapes
- Loading branch information
Dominik Hurnaus
committed
Mar 19, 2018
1 parent
ee03337
commit e160e2a
Showing
3 changed files
with
34 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,36 @@ | ||
L.SVG.include({ | ||
_updateShape: function (layer) { | ||
_updateShape: function _updateShape(layer) { | ||
|
||
var p = layer._point; | ||
var s = layer._radius; | ||
var shape = layer.options.shape; | ||
|
||
if(shape === "diamond"){ | ||
var d = "M "+ (p.x-s)+ " "+ (p.y)+ ", L " + (p.x) +" "+ (p.y-s)+ ", L" + (p.x+s) + " " + (p.y)+ ", L" + (p.x) + " " + (p.y+s) +", L" + (p.x-s) + " " + (p.y); | ||
if (shape === "diamond") { | ||
var d = "M " + (p.x - s) + " " + (p.y) + ", L " + (p.x) + " " + (p.y - s) + ", L" + (p.x + s) + " " + (p.y) + ", L" + (p.x) + " " + (p.y + s) + ", L" + (p.x - s) + " " + (p.y); | ||
this._setPath(layer, d); | ||
} | ||
if (shape === "square") { | ||
var d = "M " + (p.x - s) + " " + (p.y - s) + ", L " + (p.x + s) + " " + (p.y - s) + ", L" + (p.x + s) + " " + (p.y + s) + ", L" + (p.x - s) + " " + (p.y + s) + ", L" + (p.x - s) + " " + (p.y - s); | ||
this._setPath(layer, d); | ||
} | ||
if(shape === "square"){ | ||
var d = "M "+ (p.x-s)+ " "+ (p.y-s)+ ", L " + (p.x+s) +" "+ (p.y-s)+ ", L" + (p.x+s) + " " + (p.y+s)+ ", L" + (p.x-s) + " " + (p.y+s) +", L" + (p.x-s) + " " + (p.y-s); | ||
if (shape === "triangle" || shape === "triangle-up") { | ||
var d = "M" + (p.x - s) + " " + (p.y + s) + " L" + (p.x) + " " + (p.y - s) + " L" + (p.x + s) + " " + (p.y + s) + " Z"; | ||
this._setPath(layer, d); | ||
} | ||
if(shape === "triangle"){ | ||
var d = "M"+ (p.x-s)+ " "+ (p.y+s)+ " L" + (p.x) +" "+ (p.y-s)+ " L" + (p.x+s) + " " + (p.y+s)+ " Z"; | ||
if (shape === "triangle-down") { | ||
var d = "M" + (p.x - s) + " " + (p.y - s) + " L" + (p.x) + " " + (p.y + s) + " L" + (p.x + s) + " " + (p.y - s) + " Z"; | ||
this._setPath(layer, d); | ||
} | ||
if(shape === "circle"){ | ||
if (shape === "circle") { | ||
this._updateCircle(layer) | ||
} | ||
if(shape === "x"){ | ||
var s = s/2 | ||
if (shape === "x") { | ||
s = s / 2; | ||
var d = 'M' + (p.x + s) + ',' + (p.y + s) + | ||
'L' + (p.x - s) + ',' + (p.y - s) + | ||
'M' + (p.x - s) + ',' + (p.y + s) + | ||
'L' + (p.x + s) + ',' + (p.y - s); | ||
'L' + (p.x - s) + ',' + (p.y - s) + | ||
'M' + (p.x - s) + ',' + (p.y + s) + | ||
'L' + (p.x + s) + ',' + (p.y - s); | ||
this._setPath(layer, d); | ||
} | ||
} | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters