change label for aspect lock on token create form, adjust dice scroll logic

This commit is contained in:
Iris Lightshard 2023-08-02 18:15:45 -06:00
parent 76c217511d
commit 4435d1e130
Signed by: nilix
GPG key ID: 3B7FBC22144E6398
8 changed files with 18 additions and 14 deletions

View file

@ -98,7 +98,7 @@ function previewSprite(source) {
function toggleAspectLock() { function toggleAspectLock() {
try { try {
const locked = $("token_aspect_lock").checked; const locked = $("token_aspect_lock").checked;
$("aspect_lock_label").innerHTML = locked ? "🔒" : "🔓" $("aspect_lock_label").innerHTML = locked ? "w:h locked" : "w:h free"
} catch {} } catch {}
} }
@ -339,7 +339,7 @@ async function uploadImg(imgType) {
if (res.ok) { if (res.ok) {
loadAdmin(tableKey.name, tableKey.passcode); loadAdmin(tableKey.name, tableKey.passcode);
} else { } else {
throw new Error("Something went wrong uploading the ${imgType} image..."); throw new Error(`Something went wrong uploading the ${imgType} image...`);
} }
} catch (err) { } catch (err) {
setErr(`${err.name}: ${err.message}`); setErr(`${err.name}: ${err.message}`);

View file

@ -111,7 +111,7 @@
<label>Sprite<select id="sprite_dropdown" onchange="previewSprite(this)"></select></label><br/> <label>Sprite<select id="sprite_dropdown" onchange="previewSprite(this)"></select></label><br/>
<label>Name<input id="token_name"/></label><br/> <label>Name<input id="token_name"/></label><br/>
<label>Width<input type="number" id="token_width" min="1" max="9999" step="1" onchange="previewSprite(this)"/></label><label id="aspect_lock_label" for="token_aspect_lock">&#128274;</label><input type="checkbox" checked id="token_aspect_lock" onchange="toggleAspectLock()"/><br/> <label>Width<input type="number" id="token_width" min="1" max="9999" step="1" onchange="previewSprite(this)"/></label><label id="aspect_lock_label" for="token_aspect_lock">w:h locked</label><input type="checkbox" checked id="token_aspect_lock" onchange="toggleAspectLock()"/><br/>
<label>Height<input type="number" id="token_height" min="1" step="1" max="9999" onchange="previewSprite(this)"/></label><br/> <label>Height<input type="number" id="token_height" min="1" step="1" max="9999" onchange="previewSprite(this)"/></label><br/>
<label>cX<input type="number" id="token_cx" min="0" max="9999" step="1" onchange="previewSprite(this)"/></label><br/> <label>cX<input type="number" id="token_cx" min="0" max="9999" step="1" onchange="previewSprite(this)"/></label><br/>
<label>cY<input type="number" id="token_cy" min="0" max="9999" step="1" onchange="previewSprite(this)"/></label><br/> <label>cY<input type="number" id="token_cy" min="0" max="9999" step="1" onchange="previewSprite(this)"/></label><br/>
@ -146,14 +146,14 @@
</form> </form>
</details> </details>
<div id="lag" style="display:none;">lag...</div> <div id="lag" style="display:none;">lag...</div>
<div class="ui_win" id="felt_info"><a href="https://hacklab.nilfm.cc/felt">felt v0.2.3</a> (<a href="https://hacklab.nilfm.cc/felt/raw/main/LICENSE">license</a>) | built with <a href="https://leafletjs.com">leaflet</a> (<a href="https://hacklab.nilfm.cc/felt/raw/main/LEAFLET_LICENSE">license</a>) </div> <div class="ui_win" id="felt_info"><a href="https://hacklab.nilfm.cc/felt">felt v0.2.5</a> (<a href="https://hacklab.nilfm.cc/felt/raw/main/LICENSE">license</a>) | built with <a href="https://leafletjs.com">leaflet</a> (<a href="https://hacklab.nilfm.cc/felt/raw/main/LEAFLET_LICENSE">license</a>) </div>
</nav> </nav>
</body> </body>
<script>L_DISABLE_3D = window.location.hash.toLowerCase() === "#no3d";</script> <script>L_DISABLE_3D = window.location.hash.toLowerCase() === "#no3d";</script>
<script src="./leaflet.js?v=1.9.4" type="text/javascript"></script> <script src="./leaflet.js?v=1.9.4" type="text/javascript"></script>
<script src="./util.js?v=0.2.2" type="text/javascript"></script> <script src="./util.js?v=0.2.5" type="text/javascript"></script>
<script src="./map.js?v=0.2.2" type="text/javascript"></script> <script src="./map.js?v=0.2.5" type="text/javascript"></script>
<script src="./socket.js?v=0.2.2" type="text/javascript"></script> <script src="./socket.js?v=0.2.5" type="text/javascript"></script>
<script src="./dice.js?v=0.2.2" type="text/javascript"></script> <script src="./dice.js?v=0.2.5" type="text/javascript"></script>
<script src="./admin.js?v=0.2.2" type="text/javascript"></script> <script src="./admin.js?v=0.2.5" type="text/javascript"></script>
</html> </html>

View file

@ -193,7 +193,7 @@ function logDice(dice) {
try{ try{
const p = formatDice(r); const p = formatDice(r);
diceLog.append(p); diceLog.append(p);
p.scrollIntoView(); diceLog.scrollTop = diceLog.scrollHeight;
} catch{} } catch{}
} }
} }

View file

@ -202,6 +202,10 @@ nav {
background: transparent; background: transparent;
} }
#aspect_lock_label {
color: var(--main_color);
}
#token_aspect_lock { #token_aspect_lock {
display: none; display: none;
} }

View file

@ -53,7 +53,7 @@ function setupDiceAutoScroll() {
if (diceWin.open) { if (diceWin.open) {
const diceLog = $("dice_log"); const diceLog = $("dice_log");
if (diceLog && diceLog.children.length > 0) { if (diceLog && diceLog.children.length > 0) {
diceLog.children[diceLog.children.length - 1].scrollIntoView(); diceLog.scrollTop = diceLog.scrollHeight;
} }
} }
}); });

View file

@ -15,6 +15,6 @@
<p><a href="/table">Get back to gaming...</a></p> <p><a href="/table">Get back to gaming...</a></p>
</main> </main>
</body> </body>
<script src="./util.js?v=0.2.1" type="text/javascript"></script> <script src="./util.js?v=0.2.5" type="text/javascript"></script>
</html> </html>
<html> <html>

View file

@ -23,5 +23,5 @@
{{end}} {{end}}
</main> </main>
</body> </body>
<script src="/table/util.js?v=0.2.2" type="text/javascript"></script> <script src="/table/util.js?v=0.2.5" type="text/javascript"></script>
</html> </html>

View file

@ -19,5 +19,5 @@
{{end}} {{end}}
</main> </main>
</body> </body>
<script src="/table/util.js?v=0.2.1" type="text/javascript"></script> <script src="/table/util.js?v=0.2.5" type="text/javascript"></script>
</html> </html>