Update magloop.html

Added spacing value.
pull/2/head
miguel 2020-10-19 23:00:47 +11:00
rodzic bb205e50da
commit 170da546fc
1 zmienionych plików z 28 dodań i 1 usunięć

Wyświetl plik

@ -7,7 +7,7 @@
<link rel="stylesheet" href="magloop.css">
</head>
<body>
<header>VK3CPU - Small Loop Antenna Calculator</header>
<header>Miguel VK3CPU - Small Loop Antenna Calculator</header>
<canvas id="3Dantenna" width="800" height="200">
3D Antenna Radiation Pattern Canvas
</canvas>
@ -384,11 +384,14 @@
ctx.lineTo(win_width/4 + loop_radius - 2*cond_radius, win_height/2 - 2*cond_radius);
ctx.lineTo(win_width/4 + loop_radius, win_height/2);
ctx.stroke();
// Write loop diameter symbol:
ctx.font = "14px arial";
ctx.textAlign = "center";
ctx.fillText("\u2300a = " + loop_diameter_slider.value.toString() + "m", win_width/4, win_height/2 - 5);
// Draw conductor diameter arrow:
ctx.beginPath();
var p1x = win_width/4 + 0.4 * (loop_radius - cond_radius);
var p1y = win_height/2 + 0.4 * (loop_radius - cond_radius);
var p2x = win_width/4 + 0.707 * (loop_radius - cond_radius);
@ -446,7 +449,31 @@
ctx.lineTo(start_x + cond_spacing * 0.5 + i * cond_spacing - cond_radius, top_y);
ctx.stroke();
}
// Draw left spacing arrow:
const dim_y = win_height * 0.9;
ctx.beginPath();
ctx.moveTo(start_x - 30, dim_y);
ctx.lineTo(start_x, dim_y);
ctx.lineTo(start_x - 10, dim_y + 10)
ctx.lineTo(start_x - 10, dim_y - 10)
ctx.lineTo(start_x, dim_y);
ctx.moveTo(start_x, dim_y - 10);
ctx.lineTo(start_x, dim_y + 10);
ctx.stroke();
// Draw right spacing arrow:
ctx.beginPath();
ctx.moveTo(start_x + cond_spacing + 30, dim_y);
ctx.lineTo(start_x + cond_spacing, dim_y);
ctx.lineTo(start_x + cond_spacing + 10, dim_y + 10)
ctx.lineTo(start_x + cond_spacing + 10, dim_y - 10)
ctx.lineTo(start_x + cond_spacing, dim_y);
ctx.moveTo(start_x + cond_spacing, dim_y - 10);
ctx.lineTo(start_x + cond_spacing, dim_y + 10);
ctx.stroke();
// Draw spacing text:
ctx.textAlign = "left";
const spc = loop_spacing_slider.value * conductor_diameter_slider.value;
ctx.fillText(spc.toPrecision(2).toString() + "mm", start_x + cond_spacing + 35, dim_y + 5);
}
drawDesign();