-
Notifications
You must be signed in to change notification settings - Fork 6
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
rectangle with 2 rounded corners #56
Comments
As a more general pattern, can we supply a cornerRadius for each corner, OR boolean flags for which corners are rounded, and which ones aren't? I'd hate to have to handle "rectangle with 1 or 3 rounded corners" separately. Thoughts? |
What if someone asks for a partially rounded triangle? |
Then they have a blank slate to write their own, because there is no scenery.Triangle, and I don't see any triangle functions in kite.Shape. |
Since the most common use case is to have the same radius for all rounded corners, this duplicates the problem that we have with scenery.Rectangle (phetsims/scenery#467).
OK with me. |
Any preferences between reusing Shape.roundedRectangle or a new function, and also between optional arguments for corners: function( x, y, width, height, arcw, arch, isUpperLeftSharp, isUpperRightSharp, isLowerRightSharp, isLowerLeftSharp ) or more of an options pattern: function( x, y, width, height, { cornerRadius: ..., roundUpperLeft: false, ... } ) or any other combination? |
Marked for developer-meeting as an API question. |
9/24/15 dev meeting: // function signature
Shape.roundedRectangleWithRadii = function( x, y, width, height, {
topLeftCornerRadius:
topRightCornerRadius:
bottomLeftCornerRadius:
bottomRightCornerRadius:
} ) { ... };
// use case
var cornerRadius = 20;
var rect = Shape.roundedRectangleWithRadii( 0, 0, 200, 100, {
topLeftCornerRadius: cornerRadius,
topRightCornerRadius: cornerRadius
} ); |
Completed, assigning for review, and to consider not including "CornerRadius" in every corner option. Any opinion on: // use case
var cornerRadius = 20;
var rect = Shape.roundedRectangleWithRadii( 0, 0, 200, 100, {
topLeft: cornerRadius,
topRight: cornerRadius
} ); |
I guess the only reason to include "CornerRadius" in each option name would be if we think there will additional options. If we don't think there will be additional options, then I recommend renaming the |
Since
where {
topLeft: 0,
topRight: 0,
bottomLeft: 0,
bottomRight: 0
} |
The suggestion in #56 (comment) seems good to me. |
+1 for #56 (comment). |
Changed, assigning @pixelzoom for review. |
👍 Closing. |
Reopening - I believe the convention in other PhET libraries is to specify 2D options with the x value first and the y value second, e.g. leftTop instead of topLeft (see Node.js in Scenery). Shouldn't we follow the same convention here? |
OK with me. Back to @jonathanolson. |
Yes, same convention please. |
From phetsims/sun#197 ...
Add support (to Shape?) for creating a Shape that is a rectangle with 2 of its adjacent corners rounded, and the other 2 corners squared.
The text was updated successfully, but these errors were encountered: