Commit 11209a0
authored
fix: positioning element inside viewbox (#2758)
# Summary
Fixes: #2078
Fixes: #1343
When `preserveAspectRatio !== "none"`, the initial `translateX` and
`translateY` values should be calculated after adjusting `scaleX` and
`scaleY` with `Math.min` or `Math.max` (depending on the `meetOrSlice`
value).
Previously `translateX` and `translateY` were computed before applying
this adjustment using the raw `scaleX` and `scaleY`. This caused
incorrect positioning of the content.
## Test Plan
Run examples from issues: #2078 and #1343
## Compatibility
| OS | Implemented |
| ------- | :---------: |
| iOS | ✅ |
| MacOS | ✅ |
| Android | ✅ |
| Web | ❌ |1 parent 5b62c5d commit 11209a0
File tree
2 files changed
+6
-0
lines changed- android/src/main/java/com/horcrux/svg
- apple/Utils
2 files changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
| |||
0 commit comments