fix(geom7): SVG снова растягивается на ширину контейнера (responsive)

Откатил неверный фикс: добавление width="W" height="H" атрибутов
заставило SVG рендериться в intrinsic-размере 180×160 px вместо
заполнения родительского контейнера. Из-за этого рисунки выглядели
маленькими.

Теперь svgBox использует правильную responsive-стратегию:
- viewBox="0 0 W H" — определяет систему координат
- preserveAspectRatio="xMidYMid meet" — сохраняет пропорции
- style="width:100%; max-width:Wpx; height:auto" — растягивает
  до ширины контейнера, но не больше intrinsic W; height auto
  держит правильное соотношение сторон через viewBox

Cache-bust ?v=5.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maxim Dolgolyov
2026-05-29 08:36:13 +03:00
parent 41f6561357
commit cf88cb88dc
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ G.svgBox = function(w, h, opts){
+'</pattern></defs>'
+'<rect width="'+w+'" height="'+h+'" fill="url(#g7-grid-'+(opts.id||'def')+')"/>';
}
return { open:'<svg viewBox="0 0 '+w+' '+h+'" width="'+w+'" height="'+h+'" style="max-width:'+(opts.maxWidth||'100%')+';height:auto;display:block;margin:'+(opts.margin||'0 auto')+';background:'+bg+';border-radius:10px;border:1px solid #e2e8f0">'+gridSvg, close:'</svg>' };
return { open:'<svg viewBox="0 0 '+w+' '+h+'" preserveAspectRatio="xMidYMid meet" style="width:100%;max-width:'+(opts.maxWidth||(w+'px'))+';height:auto;display:block;margin:'+(opts.margin||'0 auto')+';background:'+bg+';border-radius:10px;border:1px solid #e2e8f0">'+gridSvg, close:'</svg>' };
};
/* === Точка === */
+1 -1
View File
@@ -13,7 +13,7 @@
onload="renderMathInElement(document.body,{delimiters:[{left:'$$',right:'$$',display:true},{left:'$',right:'$',display:false},{left:'\\[',right:'\\]',display:true},{left:'\\(',right:'\\)',display:false}],throwOnError:false})"></script>
<script src="/js/api.js" defer></script>
<script src="/js/xp.js" defer></script>
<script src="/js/geom7_svg.js?v=4" defer></script>
<script src="/js/geom7_svg.js?v=5" defer></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Manrope:wght@600;700;800;900&family=Unbounded:wght@700;800;900&family=JetBrains+Mono:wght@500;700&display=swap" rel="stylesheet">
<style>
:root{
+1 -1
View File
@@ -13,7 +13,7 @@
onload="renderMathInElement(document.body,{delimiters:[{left:'$$',right:'$$',display:true},{left:'$',right:'$',display:false},{left:'\\[',right:'\\]',display:true},{left:'\\(',right:'\\)',display:false}],throwOnError:false})"></script>
<script src="/js/api.js" defer></script>
<script src="/js/xp.js" defer></script>
<script src="/js/geom7_svg.js?v=4" defer></script>
<script src="/js/geom7_svg.js?v=5" defer></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Manrope:wght@600;700;800;900&family=Unbounded:wght@700;800;900&family=JetBrains+Mono:wght@500;700&display=swap" rel="stylesheet">
<style>
:root{