]> danix's work - danix.xyz-2.git/commitdiff
feat: compact tag cloud spiral with controlled overlap
authorDanilo M. <redacted>
Wed, 22 Apr 2026 08:34:32 +0000 (10:34 +0200)
committerDanilo M. <redacted>
Wed, 22 Apr 2026 08:34:32 +0000 (10:34 +0200)
Tighten tag cloud spacing by adjusting spiral parameters:
- padding: 8 → -2 (allows ~2px edge overlap, ~7-10% of tag height)
- aStep: 0.3 → 0.2 (finer angular sampling per revolution)
- rScale: 0.018 → 0.013 multiplier (28% tighter spiral arms)
- attempt cap: 2000 → 3000 (compensate for smaller aStep)

Tags now cluster closer together visually while remaining readable.
Narrow viewport fallback (< 400px) and 404/sidebar placements unaffected.

Co-Authored-By: Claude Haiku 4.5 <redacted>
themes/danix-xyz-hacker/assets/js/tag-cloud-spiral.js

index 68b3d9934d34080237f4e07780dd96c150922c36..bed464523fb4b264c03a22d5ac2557609f132bd0 100644 (file)
@@ -49,9 +49,9 @@ document.addEventListener('DOMContentLoaded', function () {
     container.style.display = 'block';
     container.classList.remove('flex', 'flex-wrap');
 
-    var padding = 8; // px gap between tags
-    var aStep = 0.3; // radians per spiral step
-    var rScale = (containerWidth * 0.018); // spiral tightness
+    var padding = -2; // px gap between tags (negative allows ~2px edge overlap)
+    var aStep = 0.2; // radians per spiral step
+    var rScale = (containerWidth * 0.013); // spiral tightness
 
     var minTop = Infinity, maxBottom = -Infinity;
 
@@ -63,7 +63,7 @@ document.addEventListener('DOMContentLoaded', function () {
       var placed_rect;
 
       // Step along spiral until no collision
-      for (var attempt = 0; attempt < 2000; attempt++) {
+      for (var attempt = 0; attempt < 3000; attempt++) {
         var r = rScale * theta;
         var x = cx + r * Math.cos(theta) - w / 2;
         var y = r * Math.sin(theta) - h / 2;