mirror of
https://github.com/bszczuka/steel-training.git
synced 2025-12-21 13:23:02 +01:00
Shootoff as svg & center oversized targets
This commit is contained in:
13
app.py
13
app.py
@@ -296,16 +296,23 @@ def generate_pdf_custom():
|
||||
'ts2': (TS2_HEIGHT, TS2_WIDTH),
|
||||
'popper': (POPPER_HEIGHT, POPPER_WIDTH),
|
||||
}[target_type]
|
||||
target_height=scale * original_target_height
|
||||
target_width=scale * original_target_width
|
||||
if (size == 'a4' and target_width > 21) or (size == 'a3' and target_width > 29.7):
|
||||
oversized = True
|
||||
else:
|
||||
oversized = False
|
||||
|
||||
rendered_html = render_template(
|
||||
'pdf_template_custom.html',
|
||||
distance=distance,
|
||||
size=size,
|
||||
target_height=scale * original_target_height,
|
||||
target_width=scale * original_target_width,
|
||||
target_height=target_height,
|
||||
target_width=target_width,
|
||||
gap=scale * IPSC_GAP + scale * original_target_width,
|
||||
target_type=target_type,
|
||||
simulated_distance=simulated_distance
|
||||
simulated_distance=simulated_distance,
|
||||
oversized=oversized
|
||||
)
|
||||
# return rendered_html
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 7.9 KiB |
@@ -30,6 +30,16 @@
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
.content-oversized {
|
||||
position: relative;
|
||||
height: {{target_height}}cm; /* Paper height */
|
||||
overflow: hidden; /* Hide overflow on both sides */
|
||||
}
|
||||
.content-oversized svg {
|
||||
position: absolute;
|
||||
left: 50%; /* Move to the center */
|
||||
transform: translateX(-50%); /* Center the SVG horizontally */
|
||||
}
|
||||
|
||||
.mounting-point {
|
||||
height: 10mm;
|
||||
@@ -44,6 +54,17 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mounting-info-oversized {
|
||||
font-size: xx-small;
|
||||
color: #ccc;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
z-index: 111;
|
||||
bottom: 1.5cm;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.preview {
|
||||
display: block;
|
||||
border-bottom: solid 1px black;
|
||||
@@ -61,7 +82,7 @@
|
||||
|
||||
<body>
|
||||
<div class="page-break">
|
||||
<div class="content">
|
||||
<div class="content{% if oversized %}-oversized{% endif %}">
|
||||
{% with target_width=target_width, target_height=target_height %}
|
||||
{% if target_type == 'ipsc' %}
|
||||
{%include 'ipsc_svg.html'%}
|
||||
@@ -74,7 +95,7 @@
|
||||
{% endif%}
|
||||
{% endwith %}
|
||||
<br>
|
||||
<div class="mounting-info">
|
||||
<div class="mounting-info{% if oversized %}-oversized{% endif %}">
|
||||
{%trans%}Target{%endtrans%}: {{ target_type|upper }} | {%trans%}Simulated distance{%endtrans%}: {{ simulated_distance }}m | {%trans%}Place target on{%endtrans%}: {{distance}}m
|
||||
<br>
|
||||
Steel Training
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
border-top: solid 1px black;
|
||||
width: 100%;
|
||||
height: 75mm;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.preview-post {
|
||||
@@ -82,31 +83,18 @@
|
||||
|
||||
<div class="preview">
|
||||
{% for i in range(target_count) %}
|
||||
<div style="margin: 20mm {{preview_scale*25}}cm 0 {{preview_scale*25}}cm; display: inline-block;">
|
||||
{% if i == target_count-1 %}
|
||||
<div class="post preview-post"
|
||||
style="width: {{ preview_scale * 150}}mm; height: {{ preview_scale * 550 }}mm; left: {{i * preview_scale * 1000}}mm">
|
||||
<div class="target circle" style="
|
||||
width: {{ preview_scale * 300 }}mm;
|
||||
height: {{ preview_scale * 300 }}mm;
|
||||
bottom: {{ (preview_scale * 550) - ((preview_scale * 300)/2) }}mm;
|
||||
right: {{ (preview_scale * (300/2)) - (preview_scale * 150 * 1.5) }}mm;
|
||||
">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% with target_width=preview_scale * 30, target_height=preview_scale * 85 %}
|
||||
{% include 'popper_svg.html' %}
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
<div class="post preview-post"
|
||||
style="width: {{ preview_scale * 100}}mm; height: {{ preview_scale * 360 }}mm; left: {{i * preview_scale * 1000}}mm">
|
||||
<div class="target circle" style="
|
||||
width: {{ preview_scale * 200 }}mm;
|
||||
height: {{ preview_scale * 200 }}mm;
|
||||
bottom: {{ (preview_scale * 360) - ((preview_scale * 200)/2) }}mm;
|
||||
right: {{ (preview_scale * (200/2)) - (preview_scale * 100 * 1.5) }}mm;
|
||||
">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% with target_width=preview_scale * 20, target_height=preview_scale * 56 %}
|
||||
{% include 'popper_svg.html' %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
<p>{%trans%}Wall length required{%endtrans%}: {{ wall_length|round(1,'ceil') }}cm</p>
|
||||
@@ -124,32 +112,13 @@
|
||||
<div class="page-break">
|
||||
<div class="content">
|
||||
{% if i == target_count-1 %}
|
||||
|
||||
<div class="post"
|
||||
|
||||
style="width: {{ scale * 150}}mm; height: {{ scale * 550 }}mm;">
|
||||
<div class="target circle" style="
|
||||
width: {{ scale * 300 }}mm;
|
||||
height: {{ scale * 300 }}mm;
|
||||
bottom: {{ (scale * 550) - ((scale * 300)/2) }}mm;
|
||||
right: {{ (scale * (300/2)) - (scale * 150 * 1.5) }}mm;
|
||||
">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% with target_width=scale * 30, target_height=scale * 85 %}
|
||||
{% include 'popper_svg.html' %}
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
<div class="post"
|
||||
style="width: {{ scale * 100}}mm; height: {{ scale * 360 }}mm;">
|
||||
<div class="target circle" style="
|
||||
width: {{ scale * 200 }}mm;
|
||||
height: {{ scale * 200 }}mm;
|
||||
bottom: {{ (scale * 360) - ((scale * 200)/2) }}mm;
|
||||
right: {{ (scale * (200/2)) - (scale * 100 * 1.5) }}mm;
|
||||
">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% with target_width=scale * 20, target_height=scale * 56 %}
|
||||
{% include 'popper_svg.html' %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{% if i==0 %}
|
||||
<div class="mounting-info">{%trans%}ZERO point{%endtrans%} (Shootoff)</div>
|
||||
|
||||
Reference in New Issue
Block a user