roundabout,
created on Friday, 6 September 2024, 16:43:32 (1725641012),
received on Friday, 6 September 2024, 19:35:57 (1725651357)
Author identity: vlad <vlad.muntoiu@gmail.com>
12aa85721ea10f7e8b910677e94e4dc89cd5907c
static/style.css
@@ -137,11 +137,11 @@ iconify-icon {
}
.shape-label {
font-size: 1.5rem;
position: absolute;
font-weight: 500;
color: var(--color-shape-label-text);
pointer-events: none;
height: 32px;
pointer-events: auto;
height: 28px;
padding-left: 8px;
padding-right: 8px;
display: flex;
@@ -161,7 +161,7 @@ iconify-icon {
}
/* Only show region parts when checkbox is checked */
#annotation-zone:has(+ x-buttonbox #show-objects:checked) > .shape-container-viewonly > foreignObject > .shape-label {
#annotation-zone:has(+ x-buttonbox #show-objects:checked) > .shape-label {
opacity: 1;
transform: scale(1);
}
@@ -306,3 +306,11 @@ small {
gap: 1em;
width: 100%;
}
.thumbnail-list {
list-style: none;
margin: 0 !important;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
gap: 16px;
}
templates/picture.html
@@ -2,11 +2,9 @@
{% block title %}Picture {{ resource.title }} | gigadata{% endblock %}
{% macro shape_label(x, y, text) %}
{% if text %}
<foreignObject height="100%" width="100%" x="{{ x * size[0] }}" y="{{ y * size[1] }}">
<div class="shape-label">
{{ text }}
</div>
</foreignObject>
<div class="shape-label" style="left: {{ x * 100 }}%; top: {{ y * 100 }}%">
{{ text }}
</div>
{% endif %}
{% endmacro %}
{% block content %}
@@ -34,7 +32,6 @@
></rect>
{% set centre_x = region.json.shape.x + region.json.shape.w / 2 %}
{% set centre_y = region.json.shape.y + region.json.shape.h / 2 %}
{{ shape_label(centre_x, centre_y, region.object_id) }}
</svg>
{% elif region.json.type == "polygon" %}
<svg class="shape-container-viewonly" viewBox="0 0 {{ size[0] }} {{ size[1] }}">
@@ -45,7 +42,6 @@
{% set right = region.json.shape | sort(attribute='x') | last %}
{% set centre_x = (left.x + right.x) / 2 %}
{% set centre_y = (top.y + bottom.y) / 2 %}
{{ shape_label(centre_x, centre_y, region.object_id) }}
</svg>
{% elif region.json.type == "polyline" %}
<svg class="shape-container-viewonly" viewBox="0 0 {{ size[0] }} {{ size[1] }}">
@@ -53,14 +49,13 @@
{# Median point #}
{% set centre_x = region.json.shape | map(attribute="x") | median %}
{% set centre_y = region.json.shape | map(attribute="y") | median %}
{{ shape_label(centre_x, centre_y, region.object_id) }}
</svg>
{% elif region.json.type == "point" %}
<svg class="shape-container-viewonly" viewBox="0 0 {{ size[0] }} {{ size[1] }}">
<circle cx="{{ region.json.shape.x * size[0] }}" cy="{{ region.json.shape.y * size[1] }}" r="0" fill="none" class="shape-point shape"></circle>
{{ shape_label(region.json.shape.x, region.json.shape.y, region.object_id) }}
</svg>
{% endif %}
{{ shape_label(centre_x, centre_y, region.object_id) }}
{% endfor %}
</div>
<x-buttonbox>