feat (ui): functionaliteit knoppen auto-layout en reset-view toegevoegd
This commit is contained in:
@@ -742,7 +742,21 @@
|
||||
const btn = document.getElementById('networksRefreshBtn');
|
||||
if (btn && !btn.dataset.bound) {
|
||||
btn.dataset.bound = '1';
|
||||
btn.addEventListener('click', refresh);
|
||||
resetBtn.addEventListener('click', () => {
|
||||
if (!graphCtx) return;
|
||||
|
||||
// reset zoom
|
||||
graphCtx.svg
|
||||
.transition()
|
||||
.duration(400)
|
||||
.call(
|
||||
d3.zoom().transform,
|
||||
d3.zoomIdentity
|
||||
);
|
||||
|
||||
// restart simulation
|
||||
graphCtx.sim.alpha(0.6).restart();
|
||||
});
|
||||
}
|
||||
|
||||
// View toggle (Tabel/Kaart)
|
||||
@@ -773,10 +787,19 @@
|
||||
if (resetBtn && !resetBtn.dataset.bound) {
|
||||
resetBtn.dataset.bound = '1';
|
||||
resetBtn.addEventListener('click', () => {
|
||||
// In 3C koppelen we dit aan zoom reset + simulation reset
|
||||
const s = document.getElementById('networksMapStatus');
|
||||
if (s) s.textContent = 'Reset view (placeholder)';
|
||||
setTimeout(() => { if (s) s.textContent = 'Kaartweergave (placeholder)'; }, 900);
|
||||
if (!graphCtx) return;
|
||||
|
||||
// reset zoom
|
||||
graphCtx.svg
|
||||
.transition()
|
||||
.duration(400)
|
||||
.call(
|
||||
d3.zoom().transform,
|
||||
d3.zoomIdentity
|
||||
);
|
||||
|
||||
// restart simulation
|
||||
graphCtx.sim.alpha(0.6).restart();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -784,10 +807,8 @@
|
||||
if (layoutBtn && !layoutBtn.dataset.bound) {
|
||||
layoutBtn.dataset.bound = '1';
|
||||
layoutBtn.addEventListener('click', () => {
|
||||
// In 3C koppelen we dit aan simulation.restart()
|
||||
const s = document.getElementById('networksMapStatus');
|
||||
if (s) s.textContent = 'Auto-layout (placeholder)';
|
||||
setTimeout(() => { if (s) s.textContent = 'Kaartweergave (placeholder)'; }, 900);
|
||||
if (!graphCtx) return;
|
||||
graphCtx.sim.alpha(1).restart();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user