2020-04-22 20:03:41 +02:00
|
|
|
/**
|
|
|
|
* Setup arrow head and define the marker. The result is appended to the svg.
|
|
|
|
*/
|
|
|
|
|
2021-02-06 15:56:05 +05:30
|
|
|
// import { log } from '../logger';
|
2020-04-22 20:03:41 +02:00
|
|
|
|
|
|
|
// Only add the number of markers that the diagram needs
|
|
|
|
const insertPatterns = (elem, patternArray, type, id) => {
|
2021-07-15 11:35:12 +02:00
|
|
|
patternArray.forEach((patternName) => {
|
2020-04-22 20:03:41 +02:00
|
|
|
patterns[patternName](elem, type, id);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
{
|
|
|
|
/* <svg height="10" width="10" xmlns="http://www.w3.org/2000/svg" version="1.1">
|
|
|
|
{' '}
|
|
|
|
<defs>
|
|
|
|
{' '}
|
|
|
|
<pattern id="circles-1" patternUnits="userSpaceOnUse" width="10" height="10">
|
|
|
|
{' '}
|
|
|
|
<image
|
|
|
|
xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScxMCcgaGVpZ2h0PScxMCc+CiAgPHJlY3Qgd2lkdGg9JzEwJyBoZWlnaHQ9JzEwJyBmaWxsPSJ3aGl0ZSIgLz4KICA8Y2lyY2xlIGN4PSIxIiBjeT0iMSIgcj0iMSIgZmlsbD0iYmxhY2siLz4KPC9zdmc+"
|
|
|
|
x="0"
|
|
|
|
y="0"
|
|
|
|
width="10"
|
|
|
|
height="10"
|
|
|
|
>
|
|
|
|
{' '}
|
|
|
|
</image>{' '}
|
|
|
|
</pattern>{' '}
|
|
|
|
</defs>{' '}
|
|
|
|
</svg>; */
|
|
|
|
}
|
|
|
|
|
|
|
|
const dots = (elem, type) => {
|
|
|
|
elem
|
|
|
|
.append('defs')
|
|
|
|
.append('marker')
|
|
|
|
.attr('id', type + '-barbEnd')
|
|
|
|
.attr('refX', 19)
|
|
|
|
.attr('refY', 7)
|
|
|
|
.attr('markerWidth', 20)
|
|
|
|
.attr('markerHeight', 14)
|
|
|
|
.attr('markerUnits', 0)
|
|
|
|
.attr('orient', 'auto')
|
|
|
|
.append('path')
|
|
|
|
.attr('d', 'M 19,7 L9,13 L14,7 L9,1 Z');
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO rename the class diagram markers to something shape descriptive and semanitc free
|
|
|
|
const patterns = {
|
2021-07-15 11:35:12 +02:00
|
|
|
dots,
|
2020-04-22 20:03:41 +02:00
|
|
|
};
|
|
|
|
export default insertPatterns;
|