From f1c56f63f18f9064f5c7ebd67cc96542b703647c Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Sun, 16 Jul 2023 21:29:53 -0600 Subject: [PATCH] fix table reconnect on lag; keep scroll on token select and master list when refreshing; add token copy; v0.2.0 --- README.md | 6 ++-- static/admin.js | 31 ++++++++++++++------ static/index.html | 29 ++++++++++--------- static/map.js | 5 ++-- static/socket.js | 59 ++++++++++++++++++++++----------------- templates/error.html | 4 +-- templates/register.html | 4 +-- templates/registered.html | 4 +-- 8 files changed, 86 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 6d966ea..c013a18 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,11 @@ Joining a table also grants the admin access to the `tokens` and `sprites` panel After hitting the `New Token` button, the list of tokens is replaced with a form. The sprite can be selected from a dropdown (which sets the other fields to resonable defaults), and the name, width, height, and coordinate origin of the token can be adjusted. There is a toggle for holding the aspect ratio of the token constant, and as changes are made a live preview similar to the one in the `token select` panel is updated (with the addition of a small pink cross indicating the coordinate origin). -In the `tokens` list, a token name can be clicked to live preview or deleted with the button to the right of the name. +*Scene-building note* - The coordinate origin determintes the layering of the tokens - tokens are ordered on the z-axis based on their vertical coordinate - eg scenic tokens which should be underneath characters can have their coordinate origin at the top of the sprite, and tokens which should be rendered above others in the scene can have their coordinate origin at or below the bottom edge. -Creating or destroying tokens as well as changing the map causes updates to be sent to all clients at the same table in the same manner as (de)activating and moving tokens. +In the `tokens` list, a token name can be clicked to live preview, or you can use the buttons at right to copy (opens the form with the token's data - you can, eg, change the name and create the copy quickly) or destroy the token. + +Creating or destroying tokens as well as changing the map causes updates to be sent to all clients at the same table in the same manner as (de)activating and moving tokens, updating status, or rolling dice. ## build, run, deploy diff --git a/static/admin.js b/static/admin.js index 22a22d7..b9c5626 100644 --- a/static/admin.js +++ b/static/admin.js @@ -63,7 +63,6 @@ async function rebindUi(name, pass) { let tokenListHTML = "
"; if (tokenImgs.ok) { - tokenListHTML += ""; const tokens = (await tokenImgs.json()).sort(); tokenListHTML += "