Fixed toggles

This commit is contained in:
PeekabooSteam 2023-11-23 22:44:24 +00:00
parent 20f99c287f
commit e811c7bd46
5 changed files with 22 additions and 27 deletions

View File

@ -264,41 +264,33 @@ body.feature-forceShowUnitControlPanel #unit-control-panel {
content: "GS";
}
#unit-control-panel .switch-control .ol-switch {
.switch-control .ol-switch {
height: 23px;
width: 40px;
}
#unit-control-panel .switch-control .ol-switch[data-value="true"]>.ol-switch-fill::before {
content: "YES";
}
#unit-control-panel .switch-control .ol-switch[data-value="false"]>.ol-switch-fill::before {
content: "NO";
}
#unit-control-panel .ol-slider-value {
.ol-slider-value {
color: var(--accent-light-blue);
cursor: pointer;
font-size: 14px;
font-weight: bold;
}
#unit-control-panel .switch-control {
.switch-control {
align-items: center;
display: flex;
width: 100%;
justify-content: space-between;
}
#unit-control-panel .switch-control h4 {
.switch-control h4 {
margin: 0px;
display: flex;
align-items: center;
}
#unit-control-panel .switch-control h4 img {
.switch-control h4 img {
height: 15px;
margin-left: 10px;
cursor: pointer;
@ -316,6 +308,7 @@ body.feature-forceShowUnitControlPanel #unit-control-panel {
#advanced-settings-div > button {
background-color: var(--background-grey);
box-shadow: 0px 2px 5px #000A;
font-size:13px;
height: 40px;
padding:0 20px;

View File

@ -232,7 +232,6 @@ form {
.ol-select>.ol-select-options>div {
background-color: var(--background-grey);
box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
display: flex;
justify-content: left;
padding: 2px 15px;
@ -1496,15 +1495,19 @@ input[type=number]::-webkit-outer-spin-button {
}
.switch-control.coalition [data-value="undefined"] .ol-switch-fill {
background-color: var(--ol-switch-undefined);
background-color: var(--primary-neutral);
}
.switch-control.coalition [data-value="true"]>.ol-switch-fill::before {
content: "BLUE" !important;
.switch-control.coalition [data-value="true"] .ol-switch-fill::before {
content: "BLUE";
}
.switch-control.coalition [data-value="false"]>.ol-switch-fill::before {
content: "RED" !important;
.switch-control.coalition [data-value="false"] .ol-switch-fill::before {
content: "RED";
}
.switch-control.no-label [data-value] .ol-switch-fill::before {
content:"";
}
.ol-context-menu>ul {

View File

@ -30,7 +30,7 @@ export class MapContextMenu extends ContextMenu {
/* Create the coalition switch */
this.#coalitionSwitch = new Switch("coalition-switch", (value: boolean) => this.#onSwitchClick(value));
this.#coalitionSwitch.setValue(false);
this.#coalitionSwitch.setValue(true);
this.#coalitionSwitch.getContainer()?.addEventListener("contextmenu", (e) => this.#onSwitchRightClick());
/* Create the spawn menus for the different unit types */
@ -128,9 +128,9 @@ export class MapContextMenu extends ContextMenu {
this.getContainer()?.querySelectorAll('[data-coalition]').forEach((element: any) => { element.setAttribute("data-coalition", getApp().getActiveCoalition()) });
if (getApp().getActiveCoalition() == "blue")
this.#coalitionSwitch.setValue(false);
else if (getApp().getActiveCoalition() == "red")
this.#coalitionSwitch.setValue(true);
else if (getApp().getActiveCoalition() == "red")
this.#coalitionSwitch.setValue(false);
else
this.#coalitionSwitch.setValue(undefined);
@ -232,10 +232,10 @@ export class MapContextMenu extends ContextMenu {
/** Callback called when the user left clicks on the coalition switch
*
* @param value Switch position (false: "blue", true: "red")
* @param value Switch position (true: "blue", false: "red")
*/
#onSwitchClick(value: boolean) {
value ? getApp().setActiveCoalition("red") : getApp().setActiveCoalition("blue");
value ? getApp().setActiveCoalition("blue") : getApp().setActiveCoalition("red");
this.getContainer()?.querySelectorAll('[data-coalition]').forEach((element: any) => { element.setAttribute("data-coalition", getApp().getActiveCoalition()) });
this.#aircraftSpawnMenu.setCountries();
this.#helicopterSpawnMenu.setCountries();

View File

@ -1,7 +1,7 @@
<div id="map-contextmenu" class="ol-context-menu" oncontextmenu="return false;">
<div id="active-coalition-label" data-coalition="blue"></div>
<div class="upper-bar ol-panel">
<div id="coalition-switch" class="ol-switch ol-coalition-switch"></div>
<div class="switch-control coalition no-label"><div id="coalition-switch" class="ol-switch"></div></div>
<button data-coalition="blue" id="aircraft-spawn-button" title="Spawn aircraft" data-on-click="mapContextMenuShow"
data-on-click-params='{ "type": "aircraft" }' class="ol-contexmenu-button"><img src="/resources/theme/images/buttons/spawn/aircraft.svg" inject-svg></button>
<button data-coalition="blue" id="helicopter-spawn-button" title="Spawn helicopter" data-on-click="mapContextMenuShow"
@ -16,7 +16,6 @@
data-on-click-params='{ "type": "more" }' class="ol-contexmenu-button"><img src="/resources/theme/images/buttons/spawn/more.svg" inject-svg></button>
</div>
<div id="more-options-button-bar" class="upper-bar ol-panel hide">
<div id="coalition-switch" class="ol-switch ol-coalition-switch"></div>
<button data-coalition="blue" id="navyunit-spawn-button" title="Spawn navy unit" data-on-click="mapContextMenuShow"
data-on-click-params='{ "type": "navyunit" }' class="ol-contexmenu-button"><img src="/resources/theme/images/buttons/spawn/navyunit.svg" inject-svg></button>
<button data-coalition="blue" id="smoke-spawn-button" title="Spawn smoke" data-on-click="mapContextMenuShow"

View File

@ -9,7 +9,7 @@
<div class="accent-green app-version-number">version v0.4.7-alpha</div>
</div>
<div>
<a href="https://www.discord.com" target="_blank">Discord</a>
<a href="https://discord.gg/wWXyVVBZT7" target="_blank">Discord</a>
</div>
<div>
<a href="https://github.com/Pax1601/DCSOlympus" target="_blank">Github</a>