diff --git a/client/public/stylesheets/olympus.css b/client/public/stylesheets/olympus.css index 02b41a03..013a8290 100644 --- a/client/public/stylesheets/olympus.css +++ b/client/public/stylesheets/olympus.css @@ -666,101 +666,93 @@ body[data-hide-navyunit] #unit-visibility-control-navyunit { } #roe-buttons-container button::before, #reaction-to-threat-buttons-container button::before { + background-position:center; background-repeat: no-repeat; - background-size:16px 16px; content: ""; display:block; - height:16px; - width:16px; + height:24px; + width:24px; } -#roe-buttons-container button[title="Free"]::before { - background-image: url( "/themes/olympus/images/icons_roe_free_light.svg"); -} -#roe-buttons-container button[title="Designated free"]::before { +#roe-buttons-container button[title="Hold"]::before { background-image: url( "/themes/olympus/images/icons_roe_stop_light.svg"); } -#roe-buttons-container button[title="Designated"]::before { - background-image: url( "/themes/olympus/images/icons_roe_stop_light.svg"); +#roe-buttons-container button[title="Hold"].selected::before { + background-image: url( "/themes/olympus/images/icons_roe_stop_dark.svg"); } +/**/ + #roe-buttons-container button[title="Return"]::before { + background-image: url( "/themes/olympus/images/icons_roe_defend_light.svg"); +} + +#roe-buttons-container button[title="Return"].selected::before { + background-image: url( "/themes/olympus/images/icons_roe_defend_dark.svg"); +} + +/**/ + +#roe-buttons-container button[title="Designated"]::before { background-image: url( "/themes/olympus/images/icons_roe_target_light.svg"); } -#roe-buttons-container button[title="Hold"]::before { - background-image: url( "/themes/olympus/images/icons_actions_nothing_light.svg"); +#roe-buttons-container button[title="Designated"].selected::before { + background-image: url( "/themes/olympus/images/icons_roe_target_dark.svg"); +} + +/**/ + +#roe-buttons-container button[title="Free"]::before { + background-image: url( "/themes/olympus/images/icons_roe_free_light.svg"); } #roe-buttons-container button[title="Free"].selected::before { background-image: url( "/themes/olympus/images/icons_roe_free_dark.svg"); } -#roe-buttons-container button[title="Designated free"].selected::before { - background-image: url( "/themes/olympus/images/icons_roe_stop_dark.svg"); -} - -#roe-buttons-container button[title="Designated"].selected::before { - background-image: url( "/themes/olympus/images/icons_roe_stop_dark.svg"); -} - -#roe-buttons-container button[title="Return"].selected::before { - background-image: url( "/themes/olympus/images/icons_roe_target_dark.svg"); -} - -#roe-buttons-container button[title="Hold"].selected::before { - background-image: url( "/themes/olympus/images/icons_actions_nothing_dark.svg"); -} +/****************************************************************************************/ #reaction-to-threat-buttons-container button[title="None"]::before { - background-image: url( "/themes/olympus/images/icons_actions_nothing_light.svg"); + background-image: url( "/themes/olympus/images/icons_threat_nothing_light.svg"); } -#reaction-to-threat-buttons-container button[title="Passive"]::before { - background-image: url( "/themes/olympus/images/icons_roe_stop_light.svg"); -} - -#reaction-to-threat-buttons-container button[title="Evade"]::before { - background-image: url( "/themes/olympus/images/icons_roe_stop_light.svg"); -} - -#reaction-to-threat-buttons-container button[title="Escape"]::before { - background-image: url( "/themes/olympus/images/icons_threat_retreat_light.svg"); -} - -#reaction-to-threat-buttons-container button[title="Abort"]::before { - background-image: url( "/themes/olympus/images/icons_roe_stop_light.svg"); -} -#reaction-to-threat-buttons-container button[title="None"]::before { - background-image: url( "/themes/olympus/images/icons_actions_nothing_light.svg"); -} - - #reaction-to-threat-buttons-container button[title="None"].selected::before { - background-image: url( "/themes/olympus/images/icons_actions_nothing_dark.svg"); + background-image: url( "/themes/olympus/images/icons_threat_nothing_dark.svg"); +} + + +/**/ + + +#reaction-to-threat-buttons-container button[title="Passive"]::before { + background-image: url( "/themes/olympus/images/icons_threat_cms_light.svg"); } #reaction-to-threat-buttons-container button[title="Passive"].selected::before { - background-image: url( "/themes/olympus/images/icons_roe_stop_dark.svg"); + background-image: url( "/themes/olympus/images/icons_threat_cms_dark.svg"); +} + + +/**/ + + +#reaction-to-threat-buttons-container button[title="Evade"]::before { + background-image: url( "/themes/olympus/images/icons_threat_defend_light.svg"); } #reaction-to-threat-buttons-container button[title="Evade"].selected::before { - background-image: url( "/themes/olympus/images/icons_roe_stop_dark.svg"); + background-image: url( "/themes/olympus/images/icons_threat_defend_dark.svg"); } -#reaction-to-threat-buttons-container button[title="Escape"].selected::before { - background-image: url( "/themes/olympus/images/icons_threat_retreat_dark.svg"); -} -#reaction-to-threat-buttons-container button[title="Abort"].selected::before { - background-image: url( "/themes/olympus/images/icons_roe_stop_dark.svg"); -} +/****************************************************************************************/ #splash-screen { diff --git a/client/src/other/utils.ts b/client/src/other/utils.ts index 7de8d03c..4cacf4a4 100644 --- a/client/src/other/utils.ts +++ b/client/src/other/utils.ts @@ -26,6 +26,27 @@ export function ConvertDDToDMS(D: number, lng: boolean) { } +export function dataPointMap( container:HTMLElement, data:any) { + + Object.keys( data ).forEach( ( key ) => { + + const val = "" + data[ key ]; // Ensure a string + + container.querySelectorAll( `[data-point="${key}"]`).forEach( el => { + + // We could probably have options here + if ( el instanceof HTMLInputElement ) { + el.value = val; + } else if ( el instanceof HTMLElement ) { + el.innerText = val; + } + }); + + }); + +} + + export function deg2rad(deg: number) { var pi = Math.PI; return deg * (pi / 180); diff --git a/client/src/panels/unitcontrolpanel.ts b/client/src/panels/unitcontrolpanel.ts index 745a237c..6ed8e807 100644 --- a/client/src/panels/unitcontrolpanel.ts +++ b/client/src/panels/unitcontrolpanel.ts @@ -1,14 +1,18 @@ import { getUnitsManager } from ".."; import { Slider } from "../controls/slider"; +import { dataPointMap } from "../other/utils"; import { aircraftDatabase } from "../units/aircraftdatabase"; import { groundUnitsDatabase } from "../units/groundunitsdatabase"; import { Aircraft, GroundUnit, Unit } from "../units/unit"; import { UnitDatabase } from "../units/unitdatabase"; -import { UnitsManager } from "../units/unitsmanager"; import { Panel } from "./panel"; -const ROEs: string[] = ["Free", "Designated free", "Designated", "Return", "Hold"]; -const reactionsToThreat: string[] = ["None", "Passive", "Evade", "Escape", "Abort"]; +// const ROEs: string[] = ["Free", "Designated free", "Designated", "Return", "Hold"]; // Full list +// const reactionsToThreat: string[] = ["None", "Passive", "Evade", "Escape", "Abort"]; // Full list + +const ROEs: string[] = [ "Hold", "Return", "Designated", "Free" ]; +const reactionsToThreat: string[] = [ "None", "Passive", "Evade" ]; + const minSpeedValues: { [key: string]: number } = { Aircraft: 100, Helicopter: 0, NavyUnit: 0, GroundUnit: 0 }; const maxSpeedValues: { [key: string]: number } = { Aircraft: 800, Helicopter: 300, NavyUnit: 60, GroundUnit: 60 }; const speedIncrements: { [key: string]: number } = { Aircraft: 25, Helicopter: 10, NavyUnit: 5, GroundUnit: 5 }; @@ -71,21 +75,23 @@ export class UnitControlPanel extends Panel { if (index === 0) { this.getElement().querySelectorAll(`[data-object|="unit"]`).forEach(marker => { + marker.setAttribute("data-coalition", unit.getMissionData().coalition); - const shortLabel = marker.querySelector(".unit-short-label"); - if (shortLabel) - shortLabel.innerText = database?.getByName(unit.getBaseData().name)?.shortLabel || ""; + + dataPointMap( this.getElement(), { + "shortLabel" : database?.getByName(unit.getBaseData().name)?.shortLabel, + "unitName": unit.getBaseData().unitName + }); + }); } var button = document.createElement("button"); - const unitName = this.getElement().querySelector("#unit-name"); var callsign = unit.getBaseData().unitName || ""; - button.innerText = ""; + button.innerText = unit.getBaseData().unitName; button.setAttribute("data-short-label", database?.getByName(unit.getBaseData().name)?.shortLabel || ""); button.setAttribute("data-callsign", callsign); - unitName.value = callsign; button.setAttribute("data-coalition", unit.getMissionData().coalition); button.classList.add("pill", "highlight-coalition") diff --git a/client/views/unitcontrolpanel.ejs b/client/views/unitcontrolpanel.ejs index f2820e51..a95ef177 100644 --- a/client/views/unitcontrolpanel.ejs +++ b/client/views/unitcontrolpanel.ejs @@ -5,10 +5,10 @@
-
+
- +