-
Notifications
You must be signed in to change notification settings - Fork 12
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
RectangularButtonView doesn't verify that option values will work with content #448
Comments
CT is failing when button content gets too small with "xss-fuzz" test. This causes a "corner overlap" assertion failure in Shape.roundedRectangleWithRadii. Over in phetsims/projectile-motion#171, we decided:
|
This just got very complicated. See // convenience function for creating the shape of the button, done to avoid code duplication
function createButtonShape( width, height, options ) {
return Shape.roundedRectangleWithRadii( 0, 0, width, height, {
topLeft: typeof ( options.leftTopCornerRadius ) === 'number' ? options.leftTopCornerRadius : options.cornerRadius,
topRight: typeof ( options.rightTopCornerRadius ) === 'number' ? options.rightTopCornerRadius : options.cornerRadius,
bottomLeft: typeof ( options.leftBottomCornerRadius ) === 'number' ? options.leftBottomCornerRadius : options.cornerRadius,
bottomRight: typeof ( options.rightBottomCornerRadius ) === 'number' ? options.rightBottomCornerRadius : options.cornerRadius
} );
} Here I discovered that RectangularButtonView supports several options related to corner radii. In addition to cornerRadius, there are 4 corner-specific options: leftTopCornerRadius, rightTopCornerRadius, leftBottomCornerRadius, and rightBottomCornerRadius. Besides the general problems with this reported in #454 ... |
@jbphet as primary author of RectangularButtonView, do you have any suggestions? |
Putting this back on the dev meeting list, since we'll need to come up with a different solution. |
I suppose we could use function createButtonShape( width, height, options ) {
let shape = null;
try {
shape = Shape.roundedRectangleWithRadii( 0, 0, width, height, {
// the specified radius options
} );
}
catch {
console.log( 'WARNING: blah blah blah' );
shape = Shape.roundedRectangleWithRadii( 0, 0, width, height, {
cornerRadius: 0
} );
}
return shape;
} |
2/14/19 dev meeting consensus: We decided not to do the Closing. |
I ran into this over in phetsims/projectile-motion#171, where it manifested in
ComboBoxButton
, a subclass ofRectangularPushButton
.If a
RectangularPushButton
has atypically small content, it's possible that the default values forcornerRadius
,xMargin
, andyMargin
may result in overlap of the rounded corners. This will be detected and fail way down inShape.roundedRectangleWithRadii
. It would be nice if it were checked increateButtonShape
, a private function inRectangularButtonView
.The text was updated successfully, but these errors were encountered: