Fixed Reset Button
This commit is contained in:
@@ -226,16 +226,24 @@ async function clearAssignmentsOnServer() {
|
||||
// ---------------------------
|
||||
function ensureMainListContains(member, kind) {
|
||||
const container = kind === "friendly" ? friendlyContainer : enemyContainer;
|
||||
// If member is not in any group zone, ensure it's in the main list (append if not present)
|
||||
const parent = member.domElement?.parentElement;
|
||||
const isInDropZone = parent && parent.classList && parent.classList.contains("drop-zone");
|
||||
if (!isInDropZone) {
|
||||
|
||||
// Detect group zone: ids like "group-1-friendly" or "group-2-enemy"
|
||||
const isInGroupZone = parent && typeof parent.id === "string" && /^group-\d+-/.test(parent.id);
|
||||
|
||||
// If member has no parent yet, or is in a group zone, ensure it ends up in the main list
|
||||
if (!parent || isInGroupZone) {
|
||||
// If it's already in the right container, nothing to do
|
||||
if (member.domElement && member.domElement.parentElement !== container) {
|
||||
// remove from previous parent (if any) and append to main list
|
||||
const prev = member.domElement.parentElement;
|
||||
if (prev) prev.removeChild(member.domElement);
|
||||
container.appendChild(member.domElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function applyAssignmentsToDOM(assignments) {
|
||||
if (!assignments) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user