Improvements to some features, additional features, & updated documentation. #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bugfixes:
The hex conversion function from
colors.lua
presented problems when trying to hide a printer with already printed text via manipulating the alpha value. Any text colored by a style would still be visible since the value was hardcoded in the color conversion.--> This was fixed by providing the conversion with the printer's self-reference, so we could get the alpha value via
gui.get_color
using the NodeProxy stored inself.prefab
The math for creating new lines is changed as it presented odd behaviour when trying to align the text using the pivot options in the GUI node for the text parent and resize a textbox around it using text metrics. This has been mostly fixed, although important to note is that the text input into the metrics calculation needs to be sanitized to remove the style wrappers (we need to ignore things such as
{/}
). I have written asanitize()
function for this in another project, but have not added it because I think it needs a better name, and maybe even should ultimately just be changed to a text metrics function.Added features:
The style tables can now take a parameter
line_spacing
which is added to the distance between new lines.Added a
fadeout()
function which animates the alpha channel of all the nodes contained inself.current_letters
Non-conflicting styles can now be compounded when not explicitly exited with
{/}
. For example, if you have a style withcolor
as a param and another withwaving
as a param and provide printer with the following text:Before, doing
{wavestyle}
would cancel{colorstyle}
even though their parameters don't conflict - meaning to have color AND waving on the word 'gamma' you would need to create an entirely new style.Now, the styles can be stacked, with the last declared style taking priority if there are any conflicting parameters. This is done by storing the last style in self.last_style and overwriting the defaults in
get_style()
with any existing parameters. This temporary stored style is cleared only when the styles are explicitly exited using{/}
.Documentation updates:
Various small spelling and grammar changes, and conversion from passive to active voice where possible to improve clarity.
Added and changed sections to reflect new features.