diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-27 20:27:13 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-27 20:27:13 +0300 |
| commit | 5cedb6d00367463d68031e1b8b80446dffdbed04 (patch) | |
| tree | af9ac10ee4893bd6ad74babd2c0909f2cfdc1311 /internal/codeberg | |
| parent | 027bfd08e367ce520acfccf1b452687fb4bfdabb (diff) | |
showcase: dynamic SVG scaling fills browser window without letterboxing
Replace the fixed viewBox+preserveAspectRatio approach with JS-driven
rescale(). The SVG root now has no viewBox; instead rescale() runs on
load and on every resize event:
- Sets the SVG viewBox to the actual window dimensions.
- Computes a uniform scale s = min(W/CHART_W, H/CHART_H) and a
centering translate so the chart group fills the window edge-to-edge
along the limiting axis with no empty bars.
- All chart elements are wrapped in <g id="chart"> so a single
transform attribute repositions everything together.
The tooltip coordinate conversion switches from svgEl.getScreenCTM()
to chartEl.getScreenCTM() so cursor positions are expressed in chart-
local coordinates (CHART_W × CHART_H space) after the rescale transform.
Similarly, tooltip boundary clamping uses the CHART_W/CHART_H constants
instead of the now-dynamic svgEl.viewBox.baseVal.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/codeberg')
0 files changed, 0 insertions, 0 deletions
