mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added mouse events to index.ts for ol-select.
This commit is contained in:
@@ -60,13 +60,32 @@ function setup() {
|
|||||||
|
|
||||||
/* Generic clicks */
|
/* Generic clicks */
|
||||||
document.addEventListener( "click", ( ev ) => {
|
document.addEventListener( "click", ( ev ) => {
|
||||||
|
|
||||||
if ( ev instanceof PointerEvent && ev.target instanceof HTMLElement ) {
|
if ( ev instanceof PointerEvent && ev.target instanceof HTMLElement ) {
|
||||||
if ( ev.target.classList.contains( "olympus-dialog-close" ) ) {
|
if ( ev.target.classList.contains( "olympus-dialog-close" ) ) {
|
||||||
ev.target.closest( "div.olympus-dialog" )?.classList.add( "hide" );
|
ev.target.closest( "div.olympus-dialog" )?.classList.add( "hide" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/** Olympus UI ***/
|
||||||
|
document.querySelectorAll( ".ol-select" ).forEach( select => {
|
||||||
|
|
||||||
|
// Do open/close toggle
|
||||||
|
select.addEventListener( "click", ev => {
|
||||||
|
select.classList.toggle( "is-open" );
|
||||||
|
});
|
||||||
|
|
||||||
|
// Autoclose on mouseleave
|
||||||
|
select.addEventListener( "mouseleave", ev => {
|
||||||
|
select.classList.remove( "is-open" );
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/* ATC */
|
/* ATC */
|
||||||
let atcFeatureSwitch = featureSwitches.getSwitch( "atc" );
|
let atcFeatureSwitch = featureSwitches.getSwitch( "atc" );
|
||||||
if ( atcFeatureSwitch?.isEnabled() ) {
|
if ( atcFeatureSwitch?.isEnabled() ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user