Azgaar / Armoria

Heraldry generator and editor
https://azgaar.github.io/Armoria
280 stars 30 forks source link

Option to randomize specific components i.e. charges and ordinaries #59

Open latiif opened 3 years ago

latiif commented 3 years ago

When designing a COA, one might need to expirement with a specific component (shape, color, positioning etc) while keeping the other components as is.

While we have the option to randomize (reroll) a specific COA design, I suggest adding the option to randomize a specific component: a charge or an ordinary.

Something like this maybe (the dice symbol next to the delete and clone options): Screenshot_2021-02-23_20-58-53

I'd love to work on the issue if you think it's a good idea to have. This might probably entail some refactoring to the codebase responsible of generating COA's.

Azgaar commented 3 years ago

Hello and thanks for the suggestion. I would say that it's pretty easy to implement. I also plan to add an ability to generate similar-looking coas in gallery. So see a lot of variants on the same screen and to be able to select from.

latiif commented 3 years ago

It's been really fun working on the codebase.

Since I'm working on randomizing components (charges and ordinaries), I thought I could take a look and maybe reuse the code in src/scripts/generator.js, which seems to export only two functions.

I have to ask if you have re-factoring src/scripts/generator.js on the roadmap, because it can use some love. There are a couple of functions defined within generate that I would love to reuse for this issue, but simply taking them out was not a option due to the deep inter-dependencies between them.

What do you suggest? Take the time to refactor generate() and the entire src/scripts/generator.js file? or just find away around it? I'm asking because I intend to keep my PR small and change as few files as possible.

Azgaar commented 3 years ago

Some refactoring is indeed required, so it would be nice to split in into independent functions.

Azgaar commented 3 years ago

The refactoring PR is merged now