diff --git a/static/js/main.js b/static/js/main.js index 18a5799..aa3e180 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -323,33 +323,17 @@ const cvFooter = document.querySelector('.cv-footer'); if (!cvContainer) return; - // Get current scale to calculate ratio - const currentTransform = cvContainer.style.transform; - const currentScaleMatch = currentTransform.match(/scale\(([\d.]+)\)/); - const oldScale = currentScaleMatch ? parseFloat(currentScaleMatch[1]) : 1.0; - // Convert percentage to scale factor (100 = 1.0, 150 = 1.5, etc.) const newScale = zoomValue / 100; requestAnimationFrame(() => { - // Store current scroll position - const oldScrollTop = window.pageYOffset || document.documentElement.scrollTop; - // Apply the new scale to both container and footer + // transform-origin: top center keeps content anchored at top cvContainer.style.transform = `scale(${newScale})`; if (cvFooter) { cvFooter.style.transform = `scale(${newScale})`; } - // Calculate proportional scroll position to maintain visual position - // If zooming from 100% to 50%, content at pixel 1000 moves to pixel 500 - // So we need to scroll to pixel 500 to see the same content - const scaleRatio = newScale / oldScale; - const newScrollTop = oldScrollTop * scaleRatio; - - // Apply new scroll position to keep same content visible - window.scrollTo(0, newScrollTop); - // Update display updateZoomDisplay(zoomValue);