-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This change allows the user to change the size of the label text. #113
base: master
Are you sure you want to change the base?
Conversation
@@ -23,6 +20,8 @@ export default Kapsule({ | |||
sort: { onChange(_, state) { state.needsReparse = true }}, | |||
label: { default: d => d.name }, | |||
labelOrientation: { default: 'auto' }, // angular, radial, auto | |||
textSize: {default: 12}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be more fitting to call these two props labelFontSize
and labelStrokeWidth
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will have a look later, and follow your suggestions. Thank you for having a look!
@@ -115,7 +114,7 @@ export default Kapsule({ | |||
state.svg = el.append('svg'); | |||
state.canvas = state.svg.append('g') | |||
.style('font-family', 'sans-serif') | |||
.style('font-size', `${TEXT_FONTSIZE}px`); | |||
.style('font-size', `${state.textSize}px`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be moved to the update
section so it can react to font size changes.
@@ -23,6 +20,8 @@ export default Kapsule({ | |||
sort: { onChange(_, state) { state.needsReparse = true }}, | |||
label: { default: d => d.name }, | |||
labelOrientation: { default: 'auto' }, // angular, radial, auto | |||
textSize: {default: 12}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -23,6 +20,8 @@ export default Kapsule({ | |||
sort: { onChange(_, state) { state.needsReparse = true }}, | |||
label: { default: d => d.name }, | |||
labelOrientation: { default: 'auto' }, // angular, radial, auto | |||
textSize: {default: 12}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, would you mind adding docs and types for these new attributes?
The constants for text size and stroke width have been made configurable, with the previous constant values as defaults.