You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Using Default Values: Instead of relying on random values, we can set default values for optional properties like 'stroke_color.' If a property is not explicitly set, it defaults to a specific value (e.g., transparent or a predefined color).
Using Pair Structure: We can create a pair structure for each optional property. This structure would include the property itself and a logical flag indicating whether it has been set.
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.
The text was updated successfully, but these errors were encountered:
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.
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:
Using Default Values: Instead of relying on random values, we can set default values for optional properties like 'stroke_color.' If a property is not explicitly set, it defaults to a specific value (e.g., transparent or a predefined color).
Using Pair Structure: We can create a pair structure for each optional property. This structure would include the property itself and a logical flag indicating whether it has been set.
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.
The text was updated successfully, but these errors were encountered: