Skip to content

Commit

Permalink
Merge pull request #58 from k1LoW/fix-optimize-size
Browse files Browse the repository at this point in the history
Fix icon.OptimizeSVG resize logic
  • Loading branch information
k1LoW committed Jan 11, 2021
2 parents 521378b + 99ac9d4 commit a194f40
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions icon/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ func OptimizeSVG(b []byte, width, height float64) ([]byte, error) {
hasViewBox := false
cw := 0.0
ch := 0.0
nw := 0.0
nh := 0.0
nw := size
nh := size
for _, a := range s.Attr {
switch {
case a.Name.Local == "width":
Expand Down Expand Up @@ -100,8 +100,6 @@ func OptimizeSVG(b []byte, width, height float64) ([]byte, error) {
}
}
if cw > 0 && ch > 0 {
nw = size
nh = size
if cw > ch {
// Extend the size horizontally only if width > height
nw = size * (cw / ch)
Expand Down

0 comments on commit a194f40

Please sign in to comment.