From fb6ac40af81e1445e57a3b5ce7de36b9dbabd4d2 Mon Sep 17 00:00:00 2001 From: PeekabooSteam Date: Sun, 11 Feb 2024 15:55:13 +0000 Subject: [PATCH] Number of selected units now shown --- .../public/stylesheets/panels/unitcontrol.css | 11 +++ client/src/panels/unitcontrolpanel.ts | 8 ++ client/views/panels/unitcontrol.ejs | 77 +++++++++++++------ 3 files changed, 74 insertions(+), 22 deletions(-) diff --git a/client/public/stylesheets/panels/unitcontrol.css b/client/public/stylesheets/panels/unitcontrol.css index da629696..6e222679 100644 --- a/client/public/stylesheets/panels/unitcontrol.css +++ b/client/public/stylesheets/panels/unitcontrol.css @@ -21,6 +21,17 @@ body.feature-forceShowUnitControlPanel #unit-control-panel { margin: -5px; } +#unit-control-panel h3 .num-selected-units { + margin-left:6px; +} + +#unit-control-panel h3 .num-selected-units::before { + content:"("; +} +#unit-control-panel h3 .num-selected-units::after { + content:")"; +} + #unit-control-panel .ol-option-button button { width: 30px; height: 30px; diff --git a/client/src/panels/unitcontrolpanel.ts b/client/src/panels/unitcontrolpanel.ts index 424b36d5..91af3e15 100644 --- a/client/src/panels/unitcontrolpanel.ts +++ b/client/src/panels/unitcontrolpanel.ts @@ -176,6 +176,7 @@ export class UnitControlPanel extends Panel { if (!context.getUseUnitControlPanel()) return; + this.#updateNumberOfSelectedUnits(); super.show(); this.#speedTypeSwitch.resetExpectedValue(); this.#altitudeTypeSwitch.resetExpectedValue(); @@ -420,6 +421,13 @@ export class UnitControlPanel extends Panel { } } + #updateNumberOfSelectedUnits() { + const num = getApp().getUnitsManager().getSelectedUnits().length; + this.getElement().querySelectorAll(".num-selected-units").forEach(el => { + if (el instanceof HTMLElement) el.innerText = num + ""; + }); + } + #applyAdvancedSettings() { /* HTML Elements */ const prohibitJettisonCheckbox = this.#advancedSettingsDialog.querySelector("#prohibit-jettison-checkbox")?.querySelector("input") as HTMLInputElement; diff --git a/client/views/panels/unitcontrol.ejs b/client/views/panels/unitcontrol.ejs index 52b96555..16e2a420 100644 --- a/client/views/panels/unitcontrol.ejs +++ b/client/views/panels/unitcontrol.ejs @@ -1,8 +1,8 @@ -
+
- +
-

Selected Units

+

Selected Units

@@ -80,27 +80,35 @@
-

Enable tanker

+

Enable tanker +

-

Airborne Early Warning

+

Airborne Early Warning +

-

Operate as

+

Operate as

-

Unit active

+

Unit active +

-

Follow roads

+

Follow roads

@@ -108,28 +116,53 @@
- +
Delete unit
-
-

-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
- - - - - + + + + +
- + \ No newline at end of file