// Fonctions géométriques partagées pour le map editor (function(){ function axialToPixel(tileSize, q, r) { // pointy-top axial coordinates const x = tileSize * Math.sqrt(3) * (q + r / 2); const y = tileSize * 1.5 * r; return { x, y }; } function computeZoom(currentZoom, factor) { let z = currentZoom * factor; z = Math.max(0.1, Math.min(5, z)); return z; } function computePanOffset(offset, dx, dy) { return { x: offset.x + dx, y: offset.y + dy }; } window.MG = window.MG || {}; window.MG.geom = { axialToPixel: axialToPixel, computeZoom: computeZoom, computePanOffset: computePanOffset }; })();