From bcd5764aa03e128e06c355272b7b81eac8d4501d Mon Sep 17 00:00:00 2001 From: stale Date: Sun, 29 May 2022 20:45:03 -0300 Subject: improved pubs listing, many minor fixes --- Cargo.lock | 1 + Cargo.toml | 1 + assets/client.js | 4 ++-- assets/index.html | 13 ++++++++++--- assets/room.html | 2 +- assets/style.css | 10 ++++++++++ src/conn.rs | 2 +- src/main.rs | 40 +++++++++++++++++++++++++++++----------- src/minesweeper.rs | 4 +++- src/types.rs | 15 ++++++++++----- 10 files changed, 68 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ca41240..1853a85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1378,6 +1378,7 @@ dependencies = [ "futures-util", "rand", "serde", + "serde_json", "tokio", "warp", ] diff --git a/Cargo.toml b/Cargo.toml index c825273..6356860 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ edition = "2018" [dependencies] tokio = { version = "1", features = ["full"] } serde = { version = "1", features = ["derive"] } +serde_json = "1.0" warp = { version = "0.3", features = ["tls", "websocket"] } rand = "0.8" futures-util = "0.3" diff --git a/assets/client.js b/assets/client.js index b23222c..a6a2a73 100644 --- a/assets/client.js +++ b/assets/client.js @@ -163,8 +163,8 @@ function movSelWin(win, x, y) { } else { win.style.display = ""; } - win.style.left = (anch.x + (tpos.x * tile_w)) + 'px'; - win.style.top = (anch.y + ((tpos.y + 0.35) * tile_h)) + 'px'; + win.style.left = (window.scrollX + anch.x + (tpos.x * tile_w)) + 'px'; + win.style.top = (window.scrollY + anch.y + ((tpos.y + 0.35) * tile_h)) + 'px'; win.style.width = tile_w + 'px'; win.style.height = tile_h + 'px'; } diff --git a/assets/index.html b/assets/index.html index 6fc9c46..763b9ef 100644 --- a/assets/index.html +++ b/assets/index.html @@ -11,9 +11,16 @@