Skip to content

Commit 00eae87

Browse files
committed
Improve line arrows, and fix marker symmetry
1 parent 6866d54 commit 00eae87

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ganja.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,8 @@
649649
var make_arrow_marker_def = (color) => {
650650
if (marker_defs[color]) return ''; marker_defs[color]=true;
651651
return `<defs>
652-
<marker id="marker-${color}" orient="auto" markerWidth="10" markerHeight="10" refX="9" refY="5"><path d="M 1 0 L 9 5 L 1 10" stroke-width="1" stroke="${color||'#888'}" fill="none"/></marker>
652+
<marker id="marker-${color}" orient="auto" markerWidth="10" markerHeight="12" refX="9" refY="6">
653+
<path d="M 1 1 L 9 6 L 1 11" stroke-width="1" stroke="${color||'#888'}" stroke-linecap="round" fill="none"/></marker>
653654
</defs>`;
654655
};
655656
@@ -687,7 +688,7 @@
687688
// Lines.
688689
var loc=cga2d_nno.LDot(o).Div(o), att=cga2d_ni.Dot(o);
689690
lx=sc*(-loc.e1); ly=sc*(loc.e2); lr=Math.atan2(-o[14],o[13])/Math.PI*180;
690-
return `${make_arrow_marker_def(color||'#888')}<path style="pointer-events:none" d="M ${[-10, -5, 0, 5, 10].map(xoff => `${lx+xoff} ${ly}`).join(' L ')}" stroke-width="${lineWidth*0.005}" stroke="${color||'#888'}" transform="rotate(${lr},${lx},${ly})" marker-mid="url(#marker-${color||'#888'})" fill="none"/>`;
691+
return `${make_arrow_marker_def(color||'#888')}<path style="pointer-events:none" d="M ${[...Array(21)].map((_, i) => i - 10).map(xoff => `${lx+xoff} ${ly}`).join(' L ')}" stroke-width="${lineWidth*0.005}" stroke="${color||'#888'}" transform="rotate(${lr},${lx},${ly})" marker-mid="url(#marker-${color||'#888'})" fill="none"/>`;
691692
} else if (!is_flat && !b0 && !b1 && b2) {
692693
// Circles
693694
var loc=o.Div(cga2d_ni.LDot(o)); lx=sc*(-loc.e1); ly=sc*(loc.e2);

0 commit comments

Comments
 (0)