AnonMiraj / fig

FIG (Fortran Intuitive Graphics)
MIT License
27 stars 2 forks source link

Handling optional properties of shapes #19

Closed AnonMiraj closed 3 months ago

AnonMiraj commented 6 months ago

Currently, when properties like 'stroke_color' are omitted in shapes, the code behaves unexpectedly by using a random value. This behavior is undesirable. We need a better approach to handle optional properties like 'stroke_color.'

I have two ideas in mind:

While the first one is easy and straightforward, it will involve a lot of unnecessary operations and will bloat the resulting SVG.

The second one would work better, but I feel like it is not a very clean approach.

I would like your opinion on how to handle them.

johandweber commented 6 months ago

Without having done a lot of research, the first solution appears more straightforward. I do not know whether "bloated" SVGs are a serious problem. If so maybe you can transfer the logic of what attributes should be added into the method.. This would on the one hand increase the amout of source code in the canvas classes, but on the other hand this logic would be hidden from a user of the library.

Maybe you should wait for other suggestions.