From 0120bd5cc1e752c7c5f779ec600ec87e18017193 Mon Sep 17 00:00:00 2001
From: lopezloo <7338099+lopezloo@users.noreply.github.com>
Date: Thu, 9 Feb 2023 12:36:27 +0100
Subject: [PATCH] Style tweaks
---
index.html | 15 ++++++++++++---
loaddata.js | 2 +-
ui.js | 21 +++++++++++++++++++++
webgl.css | 33 ++++++++++++++++++++++++++++-----
4 files changed, 62 insertions(+), 9 deletions(-)
diff --git a/index.html b/index.html
index dab14e6..54a8e1c 100644
--- a/index.html
+++ b/index.html
@@ -30,9 +30,9 @@
@@ -86,6 +86,9 @@ startVehicleViewerIII(model)
else {
SelectModel(model);
}
+
+ uiSetCurrentGame("iii");
+ uiSetCurrentModel(CurrentModel.model);
});
}
@@ -104,6 +107,9 @@ startVehicleViewerVC(model)
else {
SelectModel(model);
}
+
+ uiSetCurrentGame("vc");
+ uiSetCurrentModel(CurrentModel.model);
});
}
@@ -122,6 +128,9 @@ startVehicleViewerSA(model)
else {
SelectModel(model);
}
+
+ uiSetCurrentGame("sa");
+ uiSetCurrentModel(CurrentModel.model);
});
}
diff --git a/loaddata.js b/loaddata.js
index c6f708d..be0dc2f 100644
--- a/loaddata.js
+++ b/loaddata.js
@@ -218,4 +218,4 @@ loadVehicleViewer(idefile, CB)
CB();
});
});
-}
\ No newline at end of file
+}
diff --git a/ui.js b/ui.js
index 991bb76..c8fe2b5 100644
--- a/ui.js
+++ b/ui.js
@@ -78,3 +78,24 @@ function(e) {
}
},
false);
+
+function
+uiSetCurrentGame(game) {
+ document.querySelectorAll("#control a").forEach((v) => {
+ v.classList.remove("active");
+ });
+
+ let gameSelect = document.getElementById("game-select-" + game);
+ gameSelect.classList.add("active");
+}
+
+function
+uiSetCurrentModel(model) {
+ let l = document.querySelectorAll("#objects option");
+ for(let i = 0; i < l.length; i++) {
+ if(l[i].value === model) {
+ l[i].selected = 'selected';
+ break;
+ }
+ }
+}
diff --git a/webgl.css b/webgl.css
index f834ca3..40880cf 100644
--- a/webgl.css
+++ b/webgl.css
@@ -36,11 +36,18 @@ video {
#control {
text-align: center;
+ background-color: white;
+ color: black;
+ font-family: Arial;
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 5px;
+ padding-bottom: 5px;
}
.objects-wrapper {
float: left;
- height: 100%;
+ height: calc(100% - 15px);
width: calc(100%);
}
@@ -66,7 +73,6 @@ option:hover {
bottom: 20px;
left: 130px;
- /*background-color: todo;*/
border-radius: 2px;
padding: 5px;
}
@@ -112,21 +118,29 @@ option:hover {
cursor: pointer;
}
+#control a {
+ text-decoration: none;
+}
+
+#control a:hover, #control a.active {
+ text-decoration: underline;
+}
+
@media (prefers-color-scheme: dark)
{
body, canvas {
background-color: #181818;
}
- body, a, #objects {
- color: #f5f5f5;
+ body, a, #objects, option {
+ color: #f5f5f5 !important;
}
#objects {
background-color: #292929;
}
- option:checked, option:hover {
+ option:checked, option:hover, .option:active {
background-color: #4f4f4f !important;
}
@@ -141,4 +155,13 @@ option:hover {
.custom-colors input {
border-radius: 2px;
}
+
+ #objects option:nth-child(2n) {
+ background-color: #2e2e2e;
+ }
+
+ #control {
+ background-color: #292929;
+ color: #f5f5f5;
+ }
}