diff --git a/components/CartePensees.vue b/components/CartePensees.vue index 50a87de..374f0ac 100644 --- a/components/CartePensees.vue +++ b/components/CartePensees.vue @@ -128,6 +128,16 @@ watch(() => props.active, (val) => { if (val && import.meta.client && props.data watch(() => props.data, (val) => { if (val && props.active && import.meta.client) requestAnimationFrame(() => requestAnimationFrame(() => initGraph())) }) onMounted(async () => { if (import.meta.client && props.data && props.active) { await nextTick(); initGraph() } }) onUnmounted(() => { if (simulation) simulation.stop() }) + +// Expose pour reset D3 apres resize du conteneur +function triggerResize() { + if (simulation) { + simulation.alpha(0.3).restart() + } else if (import.meta.client && props.data && props.active) { + initGraph() + } +} +defineExpose({ triggerResize })