fixed right aligned warning signs

This commit is contained in:
Waldo 2025-11-11 23:36:35 +01:00
parent 9faf959212
commit 241898eb38

View file

@ -10,10 +10,10 @@
title: ("Die Methan-Mamba"), title: ("Die Methan-Mamba"),
title_fontsize: (25pt), title_fontsize: (25pt),
signs_gridlength: 9, signs_gridlength: 9,
ghs_signs: (1,2,3,4,5,), ghs_signs: (1,2,2),
fire_signs: (1,), fire_signs: (1,2,3,4,1,1,2,2,2,2,23,4,5,1,),
warning_signs: (1,1,1), warning_signs: (1,6,2),
mandatory_actions_signs: (1,1,1,), mandatory_actions_signs: (),
tablebreak_bias: (6), tablebreak_bias: (6),
step_descriptions: ("adwa", "asdwa"), step_descriptions: ("adwa", "asdwa"),
step_image_paths: (), step_image_paths: (),
@ -24,8 +24,8 @@
materials: ((amount: "20", name: "fischascwd"),(amount: "20", name: "fischascwd")), materials: ((amount: "20", name: "fischascwd"),(amount: "20", name: "fischascwd")),
chemicals: ((amount: "20", name: "fischascwd"),(amount: "20", name: "fischascwd")), chemicals: ((amount: "20", name: "fischascwd"),(amount: "20", name: "fischascwd")),
safety_notices: ("asdw",), safety_notices: ("asdw",),
observation: ["asdwa",], observation: ["Hier gibt es etwas zu sehen",],
interpretation: [], interpretation: ["Hier sind die Gründe dafür"],
doc doc
) = { ) = {
@ -127,8 +127,29 @@ let figures = image_paths.map(path => block(
let signgrid = (range(0, signs_gridlength).map(_ => 1fr)) let signgrid = (range(0, signs_gridlength).map(_ => 1fr))
let fillerrow1 = calc.clamp(0,signs_gridlength - ghs_signs.len(),1000)
let fillerrow2 = calc.clamp(0,signs_gridlength - (fire_signs.len() + warning_signs.len() + mandatory_actions_signs.len()),1000) //Convert signs to images
let ghs_signs = ghs_signs.map(x => ghs(x))
let other_signs = (fire_signs.map(x => fire-sign(x)) +
warning_signs.map(x => warning-sign(x)) +
mandatory_actions_signs.map(x => mandatory-actions-sign(x)))
//Calculate rows needed
let num_ghsrows = calc.ceil(ghs_signs.len() / signs_gridlength)
let num_othersigns = calc.ceil(other_signs.len() / signs_gridlength)
// fill with emptys to fill from right to left
for x in range(0, signs_gridlength * num_ghsrows - ghs_signs.len() ) {
ghs_signs.insert(signs_gridlength * (num_ghsrows - 1), [])
}
for x in range(0, signs_gridlength * num_othersigns - other_signs.len() ) {
other_signs.insert(signs_gridlength * (num_othersigns - 1), [])
}
grid( grid(
columns: (1fr, 1fr), columns: (1fr, 1fr),
@ -143,18 +164,13 @@ grid(
grid( grid(
columns: signgrid, columns: signgrid,
rows: auto, rows: auto,
..(grid.cell(y: 0)[],) * fillerrow1, ..(ghs_signs)
..(ghs_signs.map(x => ghs(x)))
), ),
grid( grid(
inset: (left: 1.5pt,right: 1.5pt,top: 1.5pt,bottom: 0pt), inset: (left: 1.5pt,right: 1.5pt,top: 1.5pt,bottom: 0pt),
columns: signgrid, columns: signgrid,
rows: auto, rows: auto,
..(grid.cell(y: 0)[],) * fillerrow2, ..(other_signs)
..(fire_signs.map(x => fire-sign(x)) +
warning_signs.map(x => warning-sign(x)) +
mandatory_actions_signs.map(x => mandatory-actions-sign(x)))
) )
)) ))
@ -201,13 +217,14 @@ grid(
), ),
grid( grid(
rows: (auto,),
text("Übersicht", weight: "bold"), text("Übersicht", weight: "bold"),
v(0.4cm), v(0.4cm),
my-subfig( my-subfig(
..figures, ..figures,
columns: (auto, auto), columns: (auto, auto),
), ),
v(0.1cm)
), ),
) )
@ -238,6 +255,7 @@ grid(
text("Observation", weight: "bold"), text("Observation", weight: "bold"),
v(0.4cm), v(0.4cm),
observation, observation,
v(0.2cm),
), ),
) )
@ -249,7 +267,21 @@ grid(
rows: (auto), rows: (auto),
text("Interpretation", weight: "bold"), text("Interpretation", weight: "bold"),
v(0.4cm), v(0.4cm),
interpretation interpretation,
v(0.2cm),
),
)
grid(
columns: (1fr),
stroke: (bottom:0.5pt + black),
inset: (top: 0pt, bottom: 5pt, left: 5pt, right: 5pt),
grid(
rows: (auto),
text("Entsorgung", weight: "bold"),
v(0.4cm),
str(num_ghsrows),
v(0.2cm),
), ),
) )
// Safety Notices // Safety Notices