-
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
investigate how RectangularButtonView looks with 2 rounded corners #201
Comments
I did a quick test by changing line 90 of RectangularButtonView from this: var button = new Rectangle( 0, 0, buttonWidth, buttonHeight, options.cornerRadius, options.cornerRadius, {
fill: options.baseColor,
lineWidth: options.lineWidth
} ); to this: // Rectangle with rounded top corners and square bottom corners.
var button = new Path( new Shape()
.moveTo( 0, buttonHeight )
.lineTo( 0, options.cornerRadius )
.arc( options.cornerRadius, options.cornerRadius, options.cornerRadius, Math.PI, 1.5 * Math.PI )
.lineTo( buttonWidth - options.cornerRadius, 0 )
.arc( buttonWidth - options.cornerRadius, options.cornerRadius, options.cornerRadius, 1.5 * Math.PI, 0 )
.lineTo( buttonWidth, buttonHeight )
.close(), {
fill: options.baseColor,
lineWidth: options.lineWidth
} ); Here's the "Buttons" screen from the sun demo. Both flat and 3D "looks" seem OK to me. |
Now the question is how to change the button API so that this button shape can be specified for all buttons that extend RectangularButtonView (i.e., RectangularPushButton, RadioButtonGroupMember, RectangularMomentaryButton, RectangularToggleButton, RectangularStickyToggleButton). Assigning to @jbphet for his thoughts, since he authored much of this API. |
9/24/15 dev meeting: topLeftCornerRadius:
topRightCornerRadius:
bottomLeftCornerRadius:
bottomRightCornerRadius: Create a @jbphet will investigate. |
Implementing this depends upon phetsims/kite#56. |
I'm thinking that we should preserve
I'll implement it this way initially but am willing to change it if other developers would like a different API behavior. The only thing that is a little weird about this is that Shape.roundedRectangleWithRadii defaults its corner radii to zero when unspecified, and buttons will default the corners to something other than zero when unspecified, but I think that is a minor inconsistency that we can live with. |
Assigning to @pixelzoom for review and discussion. One other specific question: Should we change the CarouselButton API to be a bit simpler and have something like a |
@jbphet Re CarouselButton API... How about |
…rners to round based on the arrow direction, see #201
I went ahead and implemented the suggestion in the previous comment, but it seems a little awkward to me. It would feel more intuitive IMO if we were to get rid of the @pixelzoom - please let me know what you think of this suggestion. I'm happy to implement it, and can live with it as is if you have a strong preference. |
I'm fine with changing |
Btw... If we think CarouselButton might be useful in situations other than Carousel, then I would feel more strongly about keeping the more general |
Sorry, I guess I wasn't particularly clear. I'm thinking that the Since it is currently specific to the carousel (and is called CarouselButton), how about we make these changes, and generalize it if it ever becomes something more than a carousel button and the arrow direction and choice of rounded corners needs to be decoupled? |
I'm not clear on why Here's the current option documentation in CarouselButton: arrowDirection: 'up', // {string} direction that the arrow points, 'up'|'down'|'left'|'right' This would presumably become: position: 'top', // {string} where the button is located in the Carousel, 'top'|'bottom'|'left'|'right' I don't like this because it implies knowledge about where the Carousel is going to put the buttons. And we've already determined that Carousel may offer different strategies for positioning next/previous buttons in the future. See the various layout examples shown in #166 (comment). On the client side of the API, here's the current calls in Carousel: var nextButton = new CarouselButton( _.extend( { arrowDirection: isHorizontal ? 'right' : 'down' }, buttonOptions ) );
var previousButton = new CarouselButton( _.extend( { arrowDirection: isHorizontal ? 'left' : 'up' }, buttonOptions ) ); Here's what the revised calls would look like: var nextButton = new CarouselButton( _.extend( { position: isHorizontal ? 'right' : 'bottom' }, buttonOptions ) );
var previousButton = new CarouselButton( _.extend( { position: isHorizontal ? 'left' : 'top' }, buttonOptions ) ); In both cases, the Carousel orientation needs to be converted to a CarouselButton option. And I don't see how So my 2 cents would be to leave this as is. |
Okay, let's leave it as is. Closing. |
This issue was extracted from #197.
Buttons with 2 rounded corners and 2 square corners are needed. For example, in sun.Carousel:
When support for this shape has been added to kite (see phetsims/kite#56), investigate how this shape works with RectangularButtonView, particularly with the pseudo-3D look, i.e.:
options.buttonAppearanceStrategy: RectangularButtonView.threeDAppearanceStrategy
The text was updated successfully, but these errors were encountered: