fix: restore exact matching logic for map locations

This commit is contained in:
2026-06-18 17:04:25 +09:00
parent 309c400ee2
commit e77c4854cb
8 changed files with 422 additions and 315 deletions

View File

@@ -213,10 +213,45 @@ export class MapEditor {
const item = document.createElement('div');
item.className = 'box-item';
item.innerHTML = `
<span>#${i+1}: [${box.x}, ${box.y}]</span>
<button class="btn-del" onclick="removeBox(${i})">×</button>
<div class="box-header">
<span class="box-index">#${i+1}</span>
<button class="btn-del" onclick="removeBox(${i})">×</button>
</div>
<div class="box-inputs">
<div class="input-group">
<label>X</label>
<input type="number" step="0.01" value="${box.x}" data-index="${i}" data-prop="x">
</div>
<div class="input-group">
<label>Y</label>
<input type="number" step="0.01" value="${box.y}" data-index="${i}" data-prop="y">
</div>
<div class="input-group">
<label>W</label>
<input type="number" step="0.01" value="${box.w}" data-index="${i}" data-prop="w">
</div>
<div class="input-group">
<label>H</label>
<input type="number" step="0.01" value="${box.h}" data-index="${i}" data-prop="h">
</div>
</div>
`;
this.boxListEl.appendChild(item);
});
// Add events to new inputs
this.boxListEl.querySelectorAll('input').forEach(input => {
input.addEventListener('change', (e) => {
const target = e.target as HTMLInputElement;
const index = parseInt(target.dataset.index!);
const prop = target.dataset.prop!;
const val = parseFloat(target.value).toFixed(2);
if (this.boxes[index]) {
this.boxes[index][prop] = val;
this.render(); // Re-render to update the map and sync other inputs
}
});
});
}
}