diff --git a/client/src/panels/unitcontrolpanel.ts b/client/src/panels/unitcontrolpanel.ts index d2e55363..7c262781 100644 --- a/client/src/panels/unitcontrolpanel.ts +++ b/client/src/panels/unitcontrolpanel.ts @@ -87,8 +87,8 @@ export class UnitControlPanel extends Panel { this.hide(); // This is for when a ctrl-click happens on the map for deselection and we need to remove the selected unit from the panel - document.addEventListener( "unitDeselected", ( ev:CustomEventInit ) => { - this.getElement().querySelector( `button[data-unit-id="${ev.detail.unit.ID}"]` )?.remove(); + document.addEventListener( "unitDeselection", ( ev:CustomEventInit ) => { + this.getElement().querySelector( `button[data-unit-id="${ev.detail.ID}"]` )?.remove(); }); } diff --git a/client/src/unit/unit.ts b/client/src/unit/unit.ts index 3a3f2cd4..f44346e3 100644 --- a/client/src/unit/unit.ts +++ b/client/src/unit/unit.ts @@ -721,15 +721,13 @@ export class Unit extends CustomMarker { // Tell everyone a unit (de-)selection has happened, usually a panel or something. const detail = { - "detail": { - "unit": this - } + "detail": this }; if ( unitIsSelected ) { - document.dispatchEvent( new CustomEvent( "unitSelected", detail ) ); + document.dispatchEvent( new CustomEvent( "unitSelection", detail ) ); } else { - document.dispatchEvent( new CustomEvent( "unitDeselected", detail ) ); + document.dispatchEvent( new CustomEvent( "unitDeselection", detail ) ); } }