roundabout,
created on Saturday, 4 January 2025, 11:02:22 (1735988542),
received on Saturday, 4 January 2025, 14:08:16 (1735999696)
Author identity: vlad <vlad.muntoiu@gmail.com>
c496f1db969c62ef7c8db5481a0e1b253a4575c5
static/picture-annotation.py
@@ -228,10 +228,6 @@ async def focus_shape(shape):
document.addEventListener("keydown", next_shape_key_proxy)
document.addEventListener("keydown", previous_shape_key_proxy)
object_list.style.display = "flex"
object_list.style.left = str(get_centre(shape)[0] / image.naturalWidth * 100) + "%"
object_list.style.top = str(get_centre(shape)[1] / image.naturalHeight * 100) + "%"
object_list.innerHTML = ""
new_radio = document.createElement("input")
@@ -261,6 +257,20 @@ async def focus_shape(shape):
object_list.appendChild(new_label)
new_radio.addEventListener("change", change_object_type_proxy)
object_list.style.display = "flex"
object_list.style.left = str(get_centre(shape)[0] / image.naturalWidth * 100) + "%"
object_list.style.top = str(get_centre(shape)[1] / image.naturalHeight * 100) + "%"
object_list.style.right = "auto"
object_list.style.bottom = "auto"
if (get_centre(shape)[0] + object_list.offsetWidth) / image.naturalWidth > 1:
object_list.style.left = "auto"
object_list.style.right = str((image.naturalWidth - get_centre(shape)[0]) / image.naturalWidth * 100) + "%"
if (get_centre(shape)[1] + object_list.offsetHeight) / image.naturalHeight > 1:
object_list.style.top = "auto"
object_list.style.bottom = str((image.naturalHeight - get_centre(shape)[1]) / image.naturalHeight * 100) + "%"
async def select_shape(event):
await focus_shape(event.target)
static/style.css
@@ -70,9 +70,16 @@ iconify-icon {
#annotation-zone, .annotation-zone {
position: relative;
user-select: none;
}
.annotation-zone {
overflow: hidden;
}
#annotation-zone {
overflow: visible;
}
#annotation-image, .annotation-image {
user-drag: none;
-webkit-user-drag: none;
@@ -779,4 +786,5 @@ nav .button-flat .ripple-pad {
border-radius: var(--radius-card);
position: absolute;
display: none;
overflow: auto;
}