Browse Source

Rename style 'weight' in 'width'

master
parent
commit
18bbee96ba
  1. 2
      README.md
  2. 2
      src/CategoryOverpass.js
  3. 12
      src/markers.js

2
README.md

@ -90,7 +90,7 @@ The following values are possible for categories (the only mandatory value is qu
* feature: an object describing how the feature will be formated resp. styled.
* style: a Leaflet style.
* stroke: Whether to draw stroke along the path. Set it to false or empty string to disable borders on polygons or circles. (boolean, true)
* weight: Stroke width in pixels (number, 3)
* width: Stroke width in pixels (number, 3)
* color: Stroke color (string, '#3388ff')
* opacity: Stroke opacity (number, 1.0)
* lineCap: shape at end of the stroke (string, 'round')

2
src/CategoryOverpass.js

@ -11,7 +11,7 @@ var defaultValues = {
markerSign: '',
'style:hover': {
color: 'black',
weight: 3,
width: 3,
opacity: 1,
radius: 12,
fill: false

12
src/markers.js

@ -5,9 +5,7 @@ function cssStyle (style) {
if ('color' in style) {
ret += 'stroke: ' + style.color + ';'
}
if ('weight' in style) {
ret += 'stroke-width: ' + style.weight + ';'
}
ret += 'stroke-width: ' + ('width' in style ? style.width : '3') + ';'
if ('dashArray' in style) {
ret += 'stroke-dasharray: ' + style.dashArray + ';'
}
@ -80,17 +78,17 @@ function markerPolygon (data) {
function markerCircle (style) {
var fillColor = 'fillColor' in style ? style.fillColor : '#f2756a'
var color = 'color' in style ? style.color : '#000000'
var weight = 'weight' in style ? style.weight : 1
var width = 'width' in style ? style.width : 1
return '<svg anchorX="13" anchorY="13" width="25" height="25"><circle cx="12.5" cy="12.5" r="12" style="stroke: ' + color + '; stroke-width: ' + weight + '; fill: ' + fillColor + ';"/></svg>'
return '<svg anchorX="13" anchorY="13" width="25" height="25"><circle cx="12.5" cy="12.5" r="12" style="stroke: ' + color + '; stroke-width: ' + width + '; fill: ' + fillColor + ';"/></svg>'
}
function markerPointer (style) {
var fillColor = 'fillColor' in style ? style.fillColor : '#f2756a'
var color = 'color' in style ? style.color : '#000000'
var weight = 'weight' in style ? style.weight : 1
var width = 'width' in style ? style.width : 1
return '<svg anchorX="13" anchorY="45" width="25" height="45"><path d="M0.5,12.5 A 12,12 0 0 1 24.5,12.5 C 24.5,23 13,30 12.5,44.5 C 12,30 0.5,23 0.5,12.5" style="stroke: ' + color + '; stroke-width: ' + weight + '; fill: ' + fillColor + ';"/></svg>'
return '<svg anchorX="13" anchorY="45" width="25" height="45"><path d="M0.5,12.5 A 12,12 0 0 1 24.5,12.5 C 24.5,23 13,30 12.5,44.5 C 12,30 0.5,23 0.5,12.5" style="stroke: ' + color + '; stroke-width: ' + width + '; fill: ' + fillColor + ';"/></svg>'
}
OverpassLayer.twig.extendFunction('markerLine', markerLine)

Loading…
Cancel
Save