1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
const drawLineArrow = (x1, y1, x2, y2) => { let path = ""; const Par = 12.0; const angle = 1.8; const slopy = Math.atan2(y1 - y2, x1 - x2);
const cosy = Math.cos(slopy); const siny = Math.sin(slopy);
const x3 = (Number(x1) + Number(x2)) / 2; const y3 = (Number(y1) + Number(y2)) / 2;
path += ` M${x3},${y3}`; path += ` L${Number(x3) + Number(Par * cosy - (Par / angle) * siny)},${Number(y3) + Number(Par * siny + (Par / angle) * cosy)}`;
path += ` L${Number(x3) + Number(Par * cosy + (Par / angle) * siny)},${Number(y3) - Number((Par / angle) * cosy - Par * siny)}`; path += ` L${x3},${y3}`;
return path; };
|