From 3ed5752627d35963717e60fac48f7e1a6ec1ba52 Mon Sep 17 00:00:00 2001 From: Hamlet3000 <75612866+Hamlet3000@users.noreply.github.com> Date: Mon, 24 Jun 2024 07:30:30 +0200 Subject: [PATCH 1/4] add style for disabled radiobuttons --- chipper/webroot/css/style.css | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/chipper/webroot/css/style.css b/chipper/webroot/css/style.css index d639bb10..1cfe9111 100755 --- a/chipper/webroot/css/style.css +++ b/chipper/webroot/css/style.css @@ -1,11 +1,12 @@ @import url("wing.css"); @font-face{ - font-family: 'IBMVGA'; + font-family: 'IBMVGA'; src: url('PxPlus_IBM_VGA_8x16.ttf') format('truetype'); /* VileR's old school font pack - int10h.org */ } + @font-face{ font-family: 'H1Weird'; src: url('h1Font.ttf') format('truetype'); @@ -81,6 +82,10 @@ input[type="text"], input[type="file"], select { text-align: center; } +input[type='text']:disabled { + cursor: not-allowed; +} + .small-hr { border: 1px solid #3e3e3e; width: 30%; @@ -233,6 +238,15 @@ input[type='radio']:checked:after { display: inline-block; } +input[type='radio']:disabled { + cursor: not-allowed; +} + +input[type='radio']:disabled:after { + background-color: var(--button-color-alt); + cursor: not-allowed; +} + /* ###################################### */ #username, #password { width: 499px !important; From d91828b94df80c5b9c5316550927a3cebbb8a408 Mon Sep 17 00:00:00 2001 From: Hamlet3000 <75612866+Hamlet3000@users.noreply.github.com> Date: Mon, 24 Jun 2024 07:32:32 +0200 Subject: [PATCH 2/4] Update style.css --- chipper/webroot/css/style.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/chipper/webroot/css/style.css b/chipper/webroot/css/style.css index 1cfe9111..09df4bb9 100755 --- a/chipper/webroot/css/style.css +++ b/chipper/webroot/css/style.css @@ -1,12 +1,11 @@ @import url("wing.css"); @font-face{ - font-family: 'IBMVGA'; + font-family: 'IBMVGA'; src: url('PxPlus_IBM_VGA_8x16.ttf') format('truetype'); /* VileR's old school font pack - int10h.org */ } - @font-face{ font-family: 'H1Weird'; src: url('h1Font.ttf') format('truetype'); From f68f088a17d21828f04ba336eb9e971612a8cf3b Mon Sep 17 00:00:00 2001 From: Hamlet3000 <75612866+Hamlet3000@users.noreply.github.com> Date: Mon, 24 Jun 2024 07:35:04 +0200 Subject: [PATCH 3/4] buttons to radiobuttons. Control depending on the functions --- chipper/webroot/sdkapp/control.html | 88 ++++++++++++++--------------- 1 file changed, 41 insertions(+), 47 deletions(-) diff --git a/chipper/webroot/sdkapp/control.html b/chipper/webroot/sdkapp/control.html index 2ddc2f80..8f092803 100755 --- a/chipper/webroot/sdkapp/control.html +++ b/chipper/webroot/sdkapp/control.html @@ -9,7 +9,7 @@ crossorigin="anonymous" > - +

Vector control (beta)

@@ -25,64 +25,56 @@

Vector control (beta)

Camera Feed

+
-
- - +
+ +

Behavior Control

- You must assume behavior control before performing any - action -
- - +
+ You must assume behavior control before performing any action +
+ +
-
+

Move Motors

-
- +
+ Toggle Keyboard Controls (unstable)
WASD for wheels, R-lift up, F-lift down, T-head up, G-head down
+
+ +
-
- Enabled! WASD for wheels, R-lift up, F-lift down, T-head up, - G-head down -
-
+

Mirror Mode

-
- - +
+
+ +
-
+
+

Say Text

Say Text id="textSay" type="text" placeholder="Put text here" + disabled />
@@ -111,3 +104,4 @@

Say Text

> + From 416bd26151188cef17b5b1ec2ef3dc91359d66f6 Mon Sep 17 00:00:00 2001 From: Hamlet3000 <75612866+Hamlet3000@users.noreply.github.com> Date: Mon, 24 Jun 2024 07:35:30 +0200 Subject: [PATCH 4/4] buttons to radiobuttons. Control depending on the functions --- chipper/webroot/sdkapp/js/control.js | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/chipper/webroot/sdkapp/js/control.js b/chipper/webroot/sdkapp/js/control.js index 2d5bf5b3..e3e6c056 100755 --- a/chipper/webroot/sdkapp/js/control.js +++ b/chipper/webroot/sdkapp/js/control.js @@ -26,6 +26,55 @@ var headIsMovingDown = false; var headIsMovingUp = false; var headIsStopped = false; +// when pages is closed +window.onbeforeunload = function() { + stopCamStream(); + useKeyboardControl = false; + sendForm("/api-sdk/mirror_mode?enable=false"); +}; + +// switches items to disabled or enables them +function updateControlButtons() { + const assumeControl = document.getElementById("assume_control"); + const releaseControl = document.getElementById("release_control"); + const keyControlOn = document.getElementById("key_control_on"); + const keyControlOff = document.getElementById("key_control_off"); + const keyMirrorOn = document.getElementById("mirror_on"); + const keyMirrorOff = document.getElementById("mirror_off"); + const textSay = document.getElementById("textSay"); + + if (assumeControl.checked) { + keyControlOn.disabled = false; + keyControlOff.disabled = false; + keyMirrorOn.disabled = false; + keyMirrorOff.disabled = false; + textSay.disabled = false; + } else if (releaseControl.checked) { + useKeyboardControl = false; + keyControlOff.checked = true; + keyControlOn.disabled = true; + keyControlOff.disabled = true; + sendForm("/api-sdk/mirror_mode?enable=false"); + keyMirrorOff.checked = true; + keyMirrorOn.disabled = true; + keyMirrorOff.disabled = true; + textSay.disabled = true; + } +} + +// Add event listener to activate keyControlOff when textSay receives the focus +document.addEventListener('DOMContentLoaded', function() { + const textSay = document.getElementById("textSay"); + const keyControlOff = document.getElementById("key_control_off"); + + textSay.addEventListener('focus', function() { + //keyControlOff.disabled = false; + keyControlOff.checked = true; + useKeyboardControl = false; + }); +}); + + function toggleKeyboard() { if (useKeyboardControl == false) { useKeyboardControl = true;