mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Smartened the button toggle logic. Could be smarter, though.
This commit is contained in:
parent
ecaf646375
commit
ceec65fb37
@ -372,6 +372,11 @@ nav.ol-panel> :last-child {
|
||||
}
|
||||
|
||||
|
||||
.ol-panel .ol-group-button-toggle button.off::before {
|
||||
background-image: url("/images/icons/square-regular.svg");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.highlight-primary {
|
||||
@ -626,12 +631,6 @@ body[data-hide-naval] #unit-visibility-control-naval {
|
||||
}
|
||||
|
||||
|
||||
[data-hide-blue] #coalition-visibility-control #coalition-visibility-control-blue::before,
|
||||
[data-hide-red] #coalition-visibility-control #coalition-visibility-control-red::before,
|
||||
[data-hide-neutral] #coalition-visibility-control #coalition-visibility-control-neutral::before {
|
||||
background-image: url("/images/icons/square-regular.svg");
|
||||
}
|
||||
|
||||
.toggle {
|
||||
--width: 40px;
|
||||
--height: calc(var(--width) / 2);
|
||||
|
||||
@ -75,11 +75,12 @@ function setup() {
|
||||
|
||||
if ( triggerElement instanceof HTMLElement ) {
|
||||
const eventName:string = triggerElement.dataset.onClick || "";
|
||||
const params:string = triggerElement.dataset.onClickParams || "{}";
|
||||
let params = JSON.parse( triggerElement.dataset.onClickParams || "{}" );
|
||||
params._element = triggerElement;
|
||||
|
||||
if ( eventName ) {
|
||||
document.dispatchEvent( new CustomEvent( eventName, {
|
||||
detail: JSON.parse( params )
|
||||
detail: params
|
||||
} ) );
|
||||
}
|
||||
|
||||
@ -130,6 +131,7 @@ function setup() {
|
||||
|
||||
|
||||
document.addEventListener( "toggleCoalitionVisibility", ( ev:CustomEventInit ) => {
|
||||
ev.detail._element.classList.toggle( "off" );
|
||||
document.body.toggleAttribute( "data-hide-" + ev.detail.coalition );
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user