feat: Label(compact=True) for tight spacing without a shared CSS change - #131
Merged
Merged
Conversation
.label-div's default margin (1cm top, 0.5cm bottom) and font-size (1.3em, bold) are sized for an occasional standalone heading, not several Labels stacked close together -- e.g. a multi-line live readout next to a slider panel, where the current spacing looks disproportionately spacious and pushes other elements off-screen. No existing example uses Label at all, so nothing currently depends on today's spacing -- but editing the shared .label-div CSS class directly would still silently change the look for any future/external caller that does want the current spacious heading style. compact=True is opt-in per-instance instead: applied as an inline style override in the JS constructor, default False leaves the shared class and every other Label untouched.
4 tasks
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.
Summary
.label-div's default margin (1cmtop,0.5cmbottom) and font-size (1.3em, bold) are sized for an occasional standalone heading, not several Labels stacked close together -- e.g. a multi-line live readout next to a slider panel, where the current spacing looks disproportionately spacious and pushes other elements off-screen (found while building a Swift teach() panel for roboticstoolbox-python -- see companion RTB PR).No existing example in this repo uses
Labelat all, so nothing currently depends on today's spacing -- but editing the shared.label-divCSS class directly would still silently change the look for any future/external caller that does want the current spacious heading style.Fix
Label(desc='', compact=False)--compact=Trueapplies a tighter margin/font-size as an inline style override in the JS constructor. DefaultFalseleaves the shared CSS class, and every otherLabelinstance, completely untouched.Test plan
tests/test_swift_element.py: newtest_label_compact_to_dict, existingtest_label_to_dictupdated for the newcompactfieldspatialgeometryPolyline gap from a stale local install, not this change)