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

Using simple math for number textboxes #1762

Closed
Jengamon opened this issue Jun 23, 2018 · 6 comments
Closed

Using simple math for number textboxes #1762

Jengamon opened this issue Jun 23, 2018 · 6 comments
Assignees
Milestone

Comments

@Jengamon
Copy link

@Jengamon Jengamon commented Jun 23, 2018

I was wondering if there are plans to support math expressions in textboxes that should take a number, esp. the new document creation dialog. Something like Krita, where instead of calculating what 32 * 22 for 22 side by side sprites of width 32, you can simply type it into the box, and the program automatically parses the statement and puts the value into the entry for you, once it loses focus. An error (math expression isn't complete; expecting an integer, but got a float, etc.) could show something like "MATH ERROR", or it could just default to 0, whichever is simpler.

@Jengamon Jengamon changed the title Using simple math for size textbox Using simple math for number textboxes Jun 23, 2018
@dacap
Copy link
Member

@dacap dacap commented Jun 23, 2018

I think someone asked for this same feature before. It might be easy to implement for the next version.

Note for developer: we can use this library https://github.com/codeplea/tinyexpr

@aseprite aseprite deleted a comment Jun 24, 2018
@dacap dacap self-assigned this Jun 27, 2018
@dacap dacap added this to the v1.2 milestone Jun 27, 2018
@dacap dacap closed this in f595cee Jun 28, 2018
@dacap
Copy link
Member

@dacap dacap commented Jun 28, 2018

A simple version will be available in the next release! 👍

@Jengamon
Copy link
Author

@Jengamon Jengamon commented Jun 28, 2018

yey!

@dante8300
Copy link

@dante8300 dante8300 commented Aug 1, 2018

Hi, can anyone provide a good example of this or how is this practical?

@dacap
Copy link
Member

@dacap dacap commented Aug 1, 2018

You can write 30*2 and you will get 60 (e.g. if you want to resize x2), or 1000/60 and you will get 33 (e.g. if you want to use Frame > Constant Frame Rate and use 60 fps)

@KasumiArai
Copy link

@KasumiArai KasumiArai commented Aug 1, 2018

If you have 16x16 tiles, you can make an image that's some amount of tiles long/tall more easily. 16*200 for width 16*40 for height.

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

Successfully merging a pull request may close this issue.

None yet
4 participants