This change allows the user to change the size of the label text. - #113
Open
nverwer wants to merge 1 commit into
Open
This change allows the user to change the size of the label text.#113nverwer wants to merge 1 commit into
nverwer wants to merge 1 commit into
Conversation
vasturiano
reviewed
Nov 23, 2023
| sort: { onChange(_, state) { state.needsReparse = true }}, | ||
| label: { default: d => d.name }, | ||
| labelOrientation: { default: 'auto' }, // angular, radial, auto | ||
| textSize: {default: 12}, |
Owner
There was a problem hiding this comment.
May be more fitting to call these two props labelFontSize and labelStrokeWidth.
Contributor
Author
There was a problem hiding this comment.
I will have a look later, and follow your suggestions. Thank you for having a look!
| state.canvas = state.svg.append('g') | ||
| .style('font-family', 'sans-serif') | ||
| .style('font-size', `${TEXT_FONTSIZE}px`); | ||
| .style('font-size', `${state.textSize}px`); |
Owner
There was a problem hiding this comment.
This needs to be moved to the update section so it can react to font size changes.
| sort: { onChange(_, state) { state.needsReparse = true }}, | ||
| label: { default: d => d.name }, | ||
| labelOrientation: { default: 'auto' }, // angular, radial, auto | ||
| textSize: {default: 12}, |
Owner
There was a problem hiding this comment.
Even though this is already an improvement, we could go a step further and turn these props into accessor functions, just like most of the other props. That way you could set different font sizes / stroke widths per individual element.
| sort: { onChange(_, state) { state.needsReparse = true }}, | ||
| label: { default: d => d.name }, | ||
| labelOrientation: { default: 'auto' }, // angular, radial, auto | ||
| textSize: {default: 12}, |
Owner
There was a problem hiding this comment.
Also, would you mind adding docs and types for these new attributes?
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.
The constants for text size and stroke width have been made configurable, with the previous constant values as defaults.