mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Refined the options a bit.
This commit is contained in:
parent
7f75905d5d
commit
01b30ccf12
@ -20,14 +20,14 @@
|
||||
column-gap: 8px;
|
||||
display:flex;
|
||||
justify-items: right;
|
||||
opacity: .85;
|
||||
opacity: .9;
|
||||
padding:5px;
|
||||
width:fit-content;
|
||||
}
|
||||
|
||||
#control-tips-panel > * > .key {
|
||||
background-color: white;
|
||||
background-color: var( --background-grey );
|
||||
border-radius: var( --border-radius-sm );
|
||||
color: var( --background-steel );
|
||||
color: white;
|
||||
padding:1px 4px;
|
||||
}
|
||||
@ -66,6 +66,12 @@ export class Airbase extends CustomMarker {
|
||||
img.onload = () => SVGInjector(img);
|
||||
el.appendChild(img);
|
||||
this.getElement()?.appendChild(el);
|
||||
el.addEventListener( "mouseover", ( ev ) => {
|
||||
document.dispatchEvent( new CustomEvent( "airbaseMouseover", { detail: this }));
|
||||
});
|
||||
el.addEventListener( "mouseout", ( ev ) => {
|
||||
document.dispatchEvent( new CustomEvent( "airbaseMouseout", { detail: this }));
|
||||
});
|
||||
el.dataset.coalition = this.#coalition;
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ export class ControlTips {
|
||||
|
||||
#element:HTMLElement;
|
||||
#cursorIsHoveringOverUnit:boolean = false;
|
||||
#cursorIsHoveringOverAirbase:boolean = false;
|
||||
#olympusApp:OlympusApp;
|
||||
#shortcutManager:ShortcutManager;
|
||||
|
||||
@ -26,6 +27,16 @@ export class ControlTips {
|
||||
this.#updateTips()
|
||||
});
|
||||
|
||||
document.addEventListener( "airbaseMouseover", ( ev:CustomEventInit ) => {
|
||||
this.#cursorIsHoveringOverAirbase = true;
|
||||
this.#updateTips();
|
||||
});
|
||||
|
||||
document.addEventListener( "airbaseMouseout", ( ev:CustomEventInit ) => {
|
||||
this.#cursorIsHoveringOverAirbase = false;
|
||||
this.#updateTips();
|
||||
});
|
||||
|
||||
document.addEventListener( "unitDeselection", ( ev:CustomEvent ) => {
|
||||
this.#updateTips();
|
||||
});
|
||||
@ -67,14 +78,11 @@ export class ControlTips {
|
||||
{
|
||||
"keys": [],
|
||||
"tips": [
|
||||
{
|
||||
"key": `W/A/S/D`,
|
||||
"action": `Pan map`,
|
||||
"showIfUnitSelected": false
|
||||
},
|
||||
{
|
||||
"key": `SHIFT`,
|
||||
"action": `Box select`,
|
||||
"showIfHoveringOverAirbase": false,
|
||||
"showIfHoveringOverUnit": false,
|
||||
"showIfUnitSelected": false
|
||||
},
|
||||
{
|
||||
@ -85,27 +93,73 @@ export class ControlTips {
|
||||
{
|
||||
"key": `Mouse1+drag`,
|
||||
"action": `Move map`,
|
||||
"showIfHoveringOverAirbase": false,
|
||||
"showIfHoveringOverUnit": false,
|
||||
"showIfUnitSelected": false
|
||||
},
|
||||
{
|
||||
"key": `Mouse2`,
|
||||
"action": `Spawn menu`,
|
||||
"showIfUnitSelected": false
|
||||
"showIfUnitSelected": false,
|
||||
"showIfHoveringOverAirbase": false,
|
||||
"showIfHoveringOverUnit": false
|
||||
},
|
||||
{
|
||||
"key": `Mouse2`,
|
||||
"action": `Quick options`,
|
||||
"showIfUnitSelected": false,
|
||||
"showIfHoveringOverAirbase": false,
|
||||
"showIfHoveringOverUnit": true
|
||||
},
|
||||
{
|
||||
"key": `Mouse2`,
|
||||
"action": `Airbase menu`,
|
||||
"showIfUnitSelected": false,
|
||||
"showIfHoveringOverAirbase": true,
|
||||
"showIfHoveringOverUnit": false
|
||||
},
|
||||
{
|
||||
"key": `Mouse2`,
|
||||
"action": `Set first waypoint`,
|
||||
"showIfHoveringOverAirbase": false,
|
||||
"showIfUnitSelected": true,
|
||||
"unitsMustBeControlled": true
|
||||
},
|
||||
{
|
||||
"key": "CTRL+Mouse2",
|
||||
"action": "Add waypoint",
|
||||
"showIfUnitSelected": true,
|
||||
"showIfHoveringOverAirbase": false,
|
||||
"unitsMustBeControlled": true
|
||||
},
|
||||
{
|
||||
"key": `Mouse2 (hold)`,
|
||||
"action": `Point operations`,
|
||||
"showIfUnitSelected": true,
|
||||
"showIfHoveringOverAirbase": false,
|
||||
"showIfHoveringOverUnit": false,
|
||||
"unitsMustBeControlled": true
|
||||
},
|
||||
{
|
||||
"key": "CTRL",
|
||||
"action": " Pin tool",
|
||||
"showIfUnitSelected": false,
|
||||
"showIfHoveringOverAirbase": false,
|
||||
"showIfHoveringOverUnit": false,
|
||||
"unitsMustBeControlled": true
|
||||
},
|
||||
{
|
||||
"key": "CTRL+Mouse2",
|
||||
"action": " Airbase menu",
|
||||
"showIfUnitSelected": true,
|
||||
"showIfHoveringOverAirbase": true,
|
||||
"unitsMustBeControlled": true
|
||||
},
|
||||
{
|
||||
"key": `Delete`,
|
||||
"action": `Delete unit`,
|
||||
"showIfHoveringOverAirbase": false,
|
||||
"showIfUnitSelected": true
|
||||
},
|
||||
{
|
||||
"key": "CTRL",
|
||||
"action": " (more...)"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -116,18 +170,22 @@ export class ControlTips {
|
||||
"key": `Mouse1`,
|
||||
"action": "Toggle pin",
|
||||
"showIfUnitSelected": false,
|
||||
"showIfHoveringOverAirbase": false,
|
||||
"showIfHoveringOverUnit": false
|
||||
},
|
||||
{
|
||||
"key": `Mouse1`,
|
||||
"action": "Toggle selection",
|
||||
"showIfUnitSelected": true,
|
||||
"showIfHoveringOverAirbase": false,
|
||||
"showIfHoveringOverUnit": true
|
||||
},
|
||||
{
|
||||
"key": `Mouse2`,
|
||||
"action": `Add waypoint`,
|
||||
"showIfUnitSelected": true
|
||||
"showIfHoveringOverAirbase": false,
|
||||
"showIfUnitSelected": true,
|
||||
"unitsMustBeControlled": true
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -176,17 +234,22 @@ export class ControlTips {
|
||||
return;
|
||||
}
|
||||
|
||||
// console.log( tip.action, "state:", this.#cursorIsHoveringOverUnit, "typeof", typeof tip.showIfHoveringOverUnit, "logic", tip.showIfHoveringOverUnit !== this.#cursorIsHoveringOverUnit );
|
||||
if ( typeof tip.showIfHoveringOverAirbase === "boolean" ) {
|
||||
if ( tip.showIfHoveringOverAirbase !== this.#cursorIsHoveringOverAirbase ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( typeof tip.showIfHoveringOverUnit === "boolean" && tip.showIfHoveringOverUnit !== this.#cursorIsHoveringOverUnit ) {
|
||||
return;
|
||||
if ( typeof tip.showIfHoveringOverUnit === "boolean" ) {
|
||||
if ( tip.showIfHoveringOverUnit !== this.#cursorIsHoveringOverUnit ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
element.innerHTML += `<div><span class="key">${tip.key}</span><span class="action">${tip.action}</span></div>`
|
||||
|
||||
});
|
||||
|
||||
// console.log( "----" );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user