mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Fixed units not selecting.
This commit is contained in:
parent
db7627ddda
commit
107c655e4c
@ -131,7 +131,7 @@ export class Unit extends Marker {
|
||||
/* Only alive units can be selected. Some units are not selectable (weapons) */
|
||||
if ((this.getData().alive || !selected) && this.#selectable && this.#selected != selected) {
|
||||
this.#selected = selected;
|
||||
this.getElement()?.querySelector(".unit")?.setAttribute("data-is-selected", String(this.getSelected()));
|
||||
this.getElement()?.querySelector( `[data-object|="unit"]` )?.toggleAttribute( "data-is-selected" );
|
||||
if (selected)
|
||||
document.dispatchEvent(new CustomEvent("unitSelection", { detail: this }));
|
||||
else
|
||||
|
||||
@ -1070,10 +1070,9 @@
|
||||
|
||||
showSection();
|
||||
|
||||
document.querySelectorAll( ".unit" ).forEach( unit => {
|
||||
document.querySelectorAll( `[data-object|="unit"]` ).forEach( unit => {
|
||||
unit.addEventListener( "click", ev => {
|
||||
console.log( unit.dataset.isSelected );
|
||||
unit.dataset.isSelected = ( unit.dataset.isSelected === "true" ) ? null : "true";
|
||||
unit.toggleAttribute( "data-is-selected" );
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user