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