Compare commits

..

2 Commits

Author SHA1 Message Date
adebaumann 1ba3e35f5a Tick size area now collapsible 2026-07-31 15:05:50 +02:00
adebaumann c549b1724a Tick size adjustable 2026-07-31 14:59:51 +02:00
3 changed files with 67 additions and 3 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: e440-generator
image: git.baumann.gr/adebaumann/e440-generator:1.02
image: git.baumann.gr/adebaumann/e440-generator:1.03
imagePullPolicy: Always
ports:
- containerPort: 5000
+22 -2
View File
@@ -447,6 +447,12 @@ def generate_svg(
custom_labels=None,
label_size=5.1126,
font_key=None,
major_len=MAJOR_LEN,
major_w=MAJOR_W,
medium_len=MEDIUM_LEN,
medium_w=MEDIUM_W,
small_len=SMALL_LEN,
small_w=SMALL_W,
):
fd = (
_FONTS.get(font_key) or _FONTS.get(_DEFAULT_FONT) or next(iter(_FONTS.values()))
@@ -589,7 +595,7 @@ def generate_svg(
)
for angle in big_angles:
parts.append(_tick_line(angle, MAJOR_LEN, MAJOR_W))
parts.append(_tick_line(angle, major_len, major_w))
if small_ticks > 0:
sub = small_ticks + 1
@@ -604,7 +610,7 @@ def generate_svg(
v = big_vals[i] + j * (big_vals[i + 1] - big_vals[i]) / sub
angle = value_to_angle(v)
length, width = (
(MEDIUM_LEN, MEDIUM_W) if j == medium_j else (SMALL_LEN, SMALL_W)
(medium_len, medium_w) if j == medium_j else (small_len, small_w)
)
parts.append(_tick_line(angle, length, width))
@@ -678,6 +684,14 @@ def generate():
small_ticks = max(0, min(20, int(request.form.get("small_ticks", 4))))
label_count = max(2, int(request.form.get("label_count", 6)))
label_size = max(0.5, min(25.0, float(request.form.get("label_size", 5.1126))))
major_len = max(0.1, min(25.0, float(request.form.get("major_len", MAJOR_LEN))))
major_w = max(0.01, min(10.0, float(request.form.get("major_w", MAJOR_W))))
medium_len = max(
0.1, min(25.0, float(request.form.get("medium_len", MEDIUM_LEN)))
)
medium_w = max(0.01, min(10.0, float(request.form.get("medium_w", MEDIUM_W))))
small_len = max(0.1, min(25.0, float(request.form.get("small_len", SMALL_LEN))))
small_w = max(0.01, min(10.0, float(request.form.get("small_w", SMALL_W))))
if request.form.get("max_is_inf") == "1":
max_val = math.inf
@@ -695,6 +709,12 @@ def generate():
custom_labels,
label_size,
font_key,
major_len,
major_w,
medium_len,
medium_w,
small_len,
small_w,
)
except ValueError as err:
return Response(str(err), status=400, mimetype="text/plain")
+44
View File
@@ -133,6 +133,17 @@
.field input:focus { border-color: var(--accent); }
.collapse-summary {
font-size: 0.75rem;
font-weight: 500;
color: var(--muted);
letter-spacing: 0.025em;
cursor: pointer;
user-select: none;
}
.collapse-summary:hover { color: var(--ink); }
/* ── Mode toggle ── */
.mode-toggle {
display: inline-flex;
@@ -378,6 +389,39 @@ Right</textarea>
<input name="label_size" type="number" step="any" min="0.5" max="25" value="5.1126" required>
</div>
</div>
<details style="margin-top:1.25rem">
<summary class="collapse-summary">Tick length &amp; thickness</summary>
<div class="row row-2" style="margin-top:0.9rem">
<div class="field">
<label>Major tick length (mm)</label>
<input name="major_len" type="number" step="0.1" min="0.1" max="25" value="4.8" required>
</div>
<div class="field">
<label>Major tick thickness (mm)</label>
<input name="major_w" type="number" step="0.01" min="0.01" max="10" value="0.8" required>
</div>
</div>
<div class="row row-2" style="margin-top:1.25rem">
<div class="field">
<label>Middle tick length (mm)</label>
<input name="medium_len" type="number" step="0.1" min="0.1" max="25" value="3.1" required>
</div>
<div class="field">
<label>Middle tick thickness (mm)</label>
<input name="medium_w" type="number" step="0.01" min="0.01" max="10" value="0.38" required>
</div>
</div>
<div class="row row-2" style="margin-top:1.25rem">
<div class="field">
<label>Minor tick length (mm)</label>
<input name="small_len" type="number" step="0.1" min="0.1" max="25" value="1.8" required>
</div>
<div class="field">
<label>Minor tick thickness (mm)</label>
<input name="small_w" type="number" step="0.01" min="0.01" max="10" value="0.28" required>
</div>
</div>
</details>
<div class="row row-2" style="margin-top:1.25rem">
<div class="field">
<label>Font</label>