Add ItemCard UI Helper#5454
Merged
sturnclaw merged 9 commits intopioneerspacesim:masterfrom Dec 25, 2022
Merged
Conversation
- Table.copy makes a shallow copy of the passed table - Add extra documentation to generic functions in the utils module
- String.interp now supports positional parameters - string __mod operator for more ergonomic use
- Math.lerp interpolates any "linear object" (addition, subtraction, multiplication operators) between two values - Math.invlerp calculates an "interpolation factor" (usually, a number between 0 and 1) for the given min/max/current values, the equivalent of taking the inverse of Math.lerp.
- Basic text tooltips are now displayed with a common and consistent font size - You can still use ui.customTooltip() to use custom styling/font size/tooltip contents - Expose explicit group handling with beginGroup() / endGroup(); reduces function call nesting in complex layouts
Split equipment section drawing into multiple functions to facilitate adding ship hardpoint display.
- Separates out display functionality from the Ship Equipment widget so other modules can display in a similar style. - Individual card types can customize display handling and define how many stats fields they want to show - Add helpers to draw an empty ItemCard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Another PR split from the Scout Mission branch. Don't expect a long shelf life before merge.
This PR improves the "equipment item card" UI paradigm used in the ship equipment display widget and breaks it out into its own generic
UI.ItemCardclass for any module to use. It also adds a helper to draw a "blank" item card (e.g. an empty item slot), and improves the ability of surrounding elements to layout correctly relative to the space it takes up.This PR also includes a slightly opinionated change that unifies all "basic tooltips" set with
ui.setTooltip()to use a consistent font size regardless of the font size active when the tooltip is set. You can override this by using the custom- tooltip facilities as needed, but this change fixes several very glaring paper-cuts with a tooltip changing font size depending on which part of the element you're hovering over.This PR also adds a number of basic utilities to the Lua execution environment:
string.interpand add implicit positional argument support.math.lerpandmath.invlerpfunctions for any objects supporting basic math operations (add, sub, mul, div).table.copyhelper