kopia lustrzana https://github.com/FacilMap/facilmap
Add possibility to add single letters as marker icons (fixes #46)
rodzic
1594beb463
commit
d1f9f0135f
|
@ -35,26 +35,23 @@
|
|||
var width = Math.round(height * 23 / 31);
|
||||
padding = padding || 0;
|
||||
|
||||
var symbolCode = "";
|
||||
if(symbol && fmIcons[symbol]) {
|
||||
symbolCode = '<g transform="translate(2.9 3.3) scale(' + (17 / 580) + ')">' + fmIcons[symbol].replace(/#000/g, '#' + borderColour) + '</g>';
|
||||
} else if(symbol && symbol.length == "1") {
|
||||
symbolCode = '<text x="11.5" y="18.06" style="font-size:18px;text-anchor:middle;font-family:\'Helvetica\'"><tspan>' + fmUtils.quoteHtml(symbol) + '</tspan></text>';
|
||||
} else {
|
||||
symbolCode = '<circle style="fill:#' + borderColour + '" cy="11" cx="11.5" r="3" />';
|
||||
}
|
||||
|
||||
var svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="' + (width + padding*2) + '" height="' + (height + padding*2) + '" version="1.1">' +
|
||||
'<g transform="translate(' + padding + ' ' + padding + ') scale(' + (width / 23) + ' ' + (height / 31) + ')">' +
|
||||
'<path style="stroke:#' + borderColour + ';stroke-linecap:round;fill:#' + colour + '" d="m11.5 0.5c-7 0-11 4-11 11s9.9375 19 11 19 11-12 11-19-4-11-11-11z" />' +
|
||||
(symbol && fmIcons[symbol] ?
|
||||
'<g transform="translate(2.9 3.3) scale(' + (17 / 580) + ')">' + fmIcons[symbol].replace(/#000/g, '#' + borderColour) + '</g>' :
|
||||
'<circle style="fill:#' + borderColour + '" cy="11" cx="11.5" r="3" />'
|
||||
) +
|
||||
symbolCode +
|
||||
'</g>' +
|
||||
'</svg>';
|
||||
|
||||
/*var svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="' + (huge ? 10000 : 21) + '" height="' + (huge ? 10000 : 25) + '" version="1.1">' +
|
||||
(randomTrash ? '<!--' + randomTrash + '-->' : '') + // Chrome seems to have a bug where it applies the CSS styles of one image the same code
|
||||
(huge ? '<g transform="matrix(1,0,0,1,5000,5000)">' : '') +
|
||||
'<path style="fill:#' + colour + ';stroke:#' + borderColour + ';stroke-width:1" d="M 0.65579587,8.5137553 10.493963,0.66460903 20.332132,8.5137553 10.493963,24.088823 Z" />' +
|
||||
'<path style="fill:#' + borderColour + ';stroke:none" d="m 12.953591,9.6886404 c 0,1.3406746 -1.090141,2.4275066 -2.434898,2.4275066 -1.3447591,0 -2.4348995,-1.086832 -2.4348995,-2.4275066 0,-1.3406751 1.0901404,-2.4275068 2.4348995,-2.4275068 1.344757,0 2.434898,1.0868317 2.434898,2.4275068 z" />' +
|
||||
(huge ? '</g>' : '') +
|
||||
'</svg>';*/
|
||||
|
||||
return "data:image/svg+xml,"+encodeURIComponent(svg);
|
||||
};
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue