Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support variable-size custom sprite sheets #211

Closed
jdecked opened this issue Aug 6, 2018 · 2 comments
Closed

Support variable-size custom sprite sheets #211

jdecked opened this issue Aug 6, 2018 · 2 comments

Comments

@jdecked
Copy link

jdecked commented Aug 6, 2018

Use case: Allow custom sprite sheets to use variable sizes (i.e. non-52x52). Currently, you can use a custom sprite sheet, but that sprite sheet is required to be 52x52. This is too small for one of my sprite sheets, but passing in sprite sheet sizes as props isn't allowed by emoji-mart.

I'm currently working on a PR for this.

@EtienneLem
Copy link
Member

Makes sense, I can see how that would be useful for anyone providing a custom sprite sheet.

Just to be sure this is really what you want though: The 52x52 is the sprite columns per rows, not the size of the emojis themselves. Having a different sprite rows/columns also implies that you’re using a different custom dataset, because the one that is provided by Emoji Mart is based on a 52x52 grid and provides the sheet_x and sheet_y position.

If by too small you meant you need bigger emojis (Emoji Mart can provide up to 64px), then all you need to do is build a new sprite with bigger emojis with the same position as the ones provided. The data also account for a gutter between each emoji (I think there’s a 1px space between each).

For example, see the difference between these 2 sheets:
https://unpkg.com/[email protected]/img/apple/sheets-256/16.png
https://unpkg.com/[email protected]/img/apple/sheets-256/64.png

Quite different in size, but both still have a 52x52 grid.

@jdecked
Copy link
Author

jdecked commented Aug 6, 2018

@EtienneLem yup! I actually want to use a sprite sheet that isn't based on a square 52x52 grid, but a rectangular grid instead. I'm providing a custom dataset as well which takes this into account when calculating the x and y positions on the sheet. Opened the PR for this: #212.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants