From 3ce8b88762763358f4cae2a017d9f26c9b595c6a Mon Sep 17 00:00:00 2001 From: frajuar <franciscojavier.juarez@estudiantes.uva.es> Date: Mon, 9 Dec 2024 11:52:13 +0100 Subject: [PATCH] final --- Js/script.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Js/script.js b/Js/script.js index 0235ab5..6615818 100644 --- a/Js/script.js +++ b/Js/script.js @@ -114,16 +114,15 @@ function dibujaMapa(seleccionAnno) { .style("stroke","black") .on("mouseover",function(event,d){ const centroid = path.centroid(d); - let textX = centroid[0] + (Math.random() * 20 - 10); // Aleatorizar un poco - let textY = centroid[1] - 20; + let textX = centroid[0] + 15; + let textY = centroid[1] - 10; // Verificar si el texto se sale hacia la parte superior - if (textY < 0) { - textY = 20; // Mover el texto hacia abajo si está fuera por arriba + if (textY < 10) { + textY = 30; // Mover el texto hacia abajo si está fuera por arriba } - // Verificar si el texto se sale hacia la parte inferior - if (textY > height - 20) { + if (textY > height - 10) { textY = height - 40; // Mover el texto hacia arriba si está fuera por abajo } -- GitLab