diff --git a/Js/script.js b/Js/script.js index 0235ab56081b26fce3eefd8e82bebcd49141d0e7..661581852d012946d759d3fee5183668feef021d 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 }