-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
I reached out to @jonathanolson on slack to ask about the documentation and expected behavior for the size option in RectangularButton. This was his response:
Partially that is a legacy hold over for the “size” option for the button. Which never matched the actual size (bounds) of the button. Ideally deprecated.
I’m not sure if the MinWidth/maxWidth not being respected changed with the refactor. Potentially there was a change?
This indicates that the documentation should be updated to state that the size option is deprecated. There are several spots where the documentation will need to be updated and clarified.
If specified, this will be the size of the button. minWidth and minHeight will be ignored, and
content will be scaled down to fit inside, accounting for margins.
If you want complete control of a button's dimensions, use options.size.
However, implementation indicates that options.size is not overriding minWidth or minHeight and that it is the other way around:
// If an initial (minimum) size is specified, use this as an override (and we will scale the content down to fit)
if ( this.options.size ) {
contentMinimumWidthWithMargins = this.options.size.width;
contentMinimumHeightWithMargins = this.options.size.height;
}
// Apply minWidth/minHeight
if ( this.options.minWidth ) {
contentMinimumWidthWithMargins = Math.max( this.options.minWidth + this.options.maxLineWidth, contentMinimumWidthWithMargins );
}
if ( this.options.minHeight ) {
contentMinimumHeightWithMargins = Math.max( this.options.minHeight + this.options.maxLineWidth, contentMinimumHeightWithMargins );
}I am tagging this for our open source ecosystem as well since it affects SceneryStack documentation.