From 2dadb8de216a3fd46a8f692c66f03336c4f71d00 Mon Sep 17 00:00:00 2001
From: Tor Andersson <tor@ccxvii.net>
Date: Sat, 21 Oct 2023 18:32:46 +0200
Subject: scroll_with_middle_mouse and scroll_into_view

---
 play.css  | 8 --------
 play.html | 2 --
 play.js   | 5 ++---
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/play.css b/play.css
index 4ac1ea1..8081f08 100644
--- a/play.css
+++ b/play.css
@@ -34,14 +34,7 @@ main {
 	background-color: dimgray;
 }
 
-#mapwrap {
-	margin: 0 auto;
-	width: 2550px;
-	height: 1940px;
-}
-
 #map {
-	position: absolute;
 	width: 2550px;
 	height: 1940px;
 }
@@ -82,7 +75,6 @@ main {
 #hexes, #pieces, #labels { position: absolute }
 
 .label {
-	user-select: none;
 	position: absolute;
 	text-align: center;
 	font-family: "Source Serif SmText";
diff --git a/play.html b/play.html
index 1a230c0..f4fb509 100644
--- a/play.html
+++ b/play.html
@@ -53,7 +53,6 @@
 
 <main data-max-zoom="2">
 
-<div id="mapwrap">
 <div id="map">
 <div id="board"></div>
 <div id="tracks"></div>
@@ -268,7 +267,6 @@
 <div id="prussian_detachment_5" class="hide prussian small y5"></div>
 <div id="prussian_detachment_6" class="hide prussian small y6"></div>
 
-</div>
 </div>
 </div>
 </main>
diff --git a/play.js b/play.js
index a666257..b4ff74c 100644
--- a/play.js
+++ b/play.js
@@ -197,7 +197,6 @@ for (let p = 0; p < ui.pieces.length; ++p) {
 	ui.pieces[p].my_name = data.pieces[p].name
 }
 
-scroll_with_middle_mouse("main")
 
 /*
  * TOOLTIPS & ACTIONS
@@ -247,7 +246,7 @@ function on_blur_hex_tip(id) {
 }
 
 function on_click_hex_tip(id) {
-	ui.hexes[id].scrollIntoView({ block:"center", inline:"center", behavior:"smooth" })
+	scroll_into_view(ui.hexes[id])
 }
 
 function on_focus_piece_tip(id) {
@@ -259,7 +258,7 @@ function on_blur_piece_tip(id) {
 }
 
 function on_click_piece_tip(id) {
-	ui.pieces[id].scrollIntoView({ block:"center", inline:"center", behavior:"smooth" })
+	scroll_into_view(ui.pieces[id])
 }
 
 function on_blur() {
-- 
cgit v1.2.3