feat: drag-reorder slots

pool.reorder() permutes slots (validated permutation) and keeps the
active selection on its slot; exposed via /grid_pool/reorder. The grid
thumbnails are drag handles; dropping on another cell reorders.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 15:12:53 +02:00
parent b115a0d449
commit 25e89ada2b
6 changed files with 91 additions and 0 deletions
+8
View File
@@ -29,3 +29,11 @@ def test_handle_set_mask(tmp_path):
m = handlers.handle_set_mask(base, "p1", 0, b"MASKBYTES")
assert m["slots"][0]["mask"] == "img_0001.mask.png"
assert (tmp_path / "p1" / "img_0001.mask.png").read_bytes() == b"MASKBYTES"
def test_handle_reorder(tmp_path):
base = str(tmp_path)
handlers.handle_add(base, "p1", _png_bytes(), "png", ts=1)
handlers.handle_add(base, "p1", _png_bytes(), "png", ts=2)
m = handlers.handle_reorder(base, "p1", [1, 0])
assert [s["image"] for s in m["slots"]] == ["img_0002.png", "img_0001.png"]