카드 클릭 시 panTo + autoPan=false로 지도 중앙 정렬 개선
This commit is contained in:
@@ -658,7 +658,7 @@ function renderWorkplaceMarkers() {
|
||||
<small>${escHtml(g.address)}</small>
|
||||
${g.ids.length > 1 ? `<div style="font-size:11px;color:#6b7280;margin:2px 0;">(${g.ids.length}개 투표소)</div>` : ''}
|
||||
${getGroupAssigneesHtml(g.ids)}
|
||||
</div>`);
|
||||
</div>`, {autoPan: false});
|
||||
markers.workplaces[g.address] = marker;
|
||||
bounds.push([g.lat, g.lng]);
|
||||
}
|
||||
@@ -680,7 +680,7 @@ function renderWorkerMarkers() {
|
||||
for (const w of d.workers) {
|
||||
const isAssigned = d.assignments[w.id];
|
||||
const marker = L.marker(getWorkerPos(w), { icon: isAssigned ? WORKER_ASSIGNED_ICON : WORKER_ICON, draggable: true })
|
||||
.addTo(map).bindPopup(buildWorkerPopup(w.id));
|
||||
.addTo(map).bindPopup(buildWorkerPopup(w.id), {autoPan: false});
|
||||
marker.on('dragend', function () { handleWorkerDragEnd(w.id, this); });
|
||||
markers.workers[w.id] = marker;
|
||||
}
|
||||
@@ -783,8 +783,10 @@ function renderWorkerList() {
|
||||
</div>`;
|
||||
card.addEventListener('click', () => {
|
||||
const pos = getWorkerPos(w);
|
||||
map.setView(pos, 16);
|
||||
if (markers.workers[w.id]) markers.workers[w.id].openPopup();
|
||||
map.panTo(pos, {animate: true, duration: 0.3});
|
||||
setTimeout(() => {
|
||||
if (markers.workers[w.id]) markers.workers[w.id].openPopup();
|
||||
}, 350);
|
||||
});
|
||||
card.addEventListener('dragstart', e => { e.dataTransfer.setData('text/plain', w.id); e.dataTransfer.effectAllowed = 'move'; card.classList.add('dragging'); });
|
||||
card.addEventListener('dragend', () => card.classList.remove('dragging'));
|
||||
@@ -851,8 +853,10 @@ function renderWorkplaceList() {
|
||||
</div>
|
||||
</div>`;
|
||||
card.addEventListener('click', () => {
|
||||
map.setView([g.lat, g.lng], 16);
|
||||
if (markers.workplaces[g.address]) markers.workplaces[g.address].openPopup();
|
||||
map.panTo([g.lat, g.lng], {animate: true, duration: 0.3});
|
||||
setTimeout(() => {
|
||||
if (markers.workplaces[g.address]) markers.workplaces[g.address].openPopup();
|
||||
}, 350);
|
||||
});
|
||||
list.appendChild(card);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user