GraphiteEditor / GraphiteEditor/Graphite

SVG importer does not apply root viewBox scaling to stroke widths

Offen
#4,515 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
27.2k
Forks
1.3k
Ø Merge
20 Std. 5 Min.
Gemergte PRs (30 T.)
57

Beschreibung

When the document width/height is different from the viewBox, geometry is scaled accordingly but not stroke widths (even when the aspect ratio is the same for both). Here's a minimal working (or in this case, failing?) example:
```svg

```
These two objects should have the same visual thickness: one is a line with stroke width of 80, another is a rectangle with height 80, no stroke.
Opening this file directly in Safari shows the intended result (also reproduced with macOS Preview, Inkscape, Firefox and Chrome):
Image

But importing this in Graphite gives this:
Image

I reproduced this issue on:
- RC6 macOS desktop app
- Graphite web app
- https://dev.graphite.art with the following _About this release_ info:
```text
Release Series: Alpha 5
Branch: master
Commit: e725f550
2026-09-07 02:57 Eastern Time
```

The issue is that the viewport is 240 × 120 while the viewBox is 960 × 480, giving a scale factor of 0.25. Both the 80-unit stroke width and the 80-unit rectangle height should render as 20 units/pixels thick. A workaround for now is simply to use the same values for width/height as for the viewBox.

Possibly related: PR #3942, issue #2435.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start at the SVG importer entry point and reproduce the issue with the minimal SVG example from the report, comparing the line stroke with the rectangle height. Trace how root width/height and viewBox scaling is applied, then verify that both objects render with the same 20-unit thickness when the scale factor is 0.25.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
computer-graphics
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
68/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.