unvt / sprite-one

MIT License
13 stars 6 forks source link

sprite.png cannot be generated properly when icons are only two #11

Closed JinIgarashi closed 1 year ago

JinIgarashi commented 2 years ago

When I put all maki icons in input folder, then execute the following command, the sprite.png is not generated properly (see the attached image) although sprite.json looks fine.

node_modules/.bin/ts-node src/bin/index.ts sprite icons -r 1

sprite

Also, if I only use airport.svg and circle.svg, the exported png only contains airport (JSON has two icons).

JinIgarashi commented 2 years ago

I think calculation of matrix.max_x and matrix.max_y has an issue.

JinIgarashi commented 2 years ago

I found if icons are only two, matrix.max_x and matrix.max_y's calculation has an issue. if both icons are 15 x 15, max_x and max_y should be 15 and 30 respectively. However, actual calculated max_x and max_y are 15 and 15. That is why an icon will be missing in sprite.