UICorner Individual Corners

UICorner is great but has it’s shortcomings, as it always applies rounding to all four corners. As a developer, I want to be able to disable each corner individually. I’ll outline an issue I come across often with UICorners:

The “Stock” text is a grey TextLabel, using a UICorner here to match the top two corners to the curve of the button.
image

There is a workaround here, just make another frame to cover the bottom corners!

But as you can see, it doesn’t work too well for TextLabels:
image

Unfortunately to get the desired result, you have to restructure the label completely. In this example I made a new Frame with a UICorner, then parented my TextLabel and the Corner cover frame underneath it.
image
image

It turns out just fine, but this step alone just adds so much more friction to developing UI.

Because this workaround requires overlapping UI elements, you cannot use any type of transparency or gradient here.
(from the selected frames, I set Frame and CornerFrame to both have BackgroundTransparency of 0.5)
image

If Roblox were to address this issue, UI can be made at a much quicker rate and be easier to maintain in the future when changing it around.

28 Likes

I went ahead and added some use cases for this

2 Likes

One current option to do this, rather than adding extra frames, is just having one outer transparent frame with ClipsDescendants on with a second frame inside it, and then applying the UICorner to the inner frame. This allows you to resize and move the inner frame to get the desired effect.

5 Likes

This is a great idea but I don’t like the idea that you can’t change the Radius of each individual one instead of it just not applying to that corner. Maybe have it something like:

TopLeftCornerRadius: 8 --[[ Pixel ]] , 0 --[[ Scale ]]
BottomLeftCornerRadius: 0, 0
TopRightCornerRadius: 8, 0
BottomRightCornerRadius: 0, 0

2 Likes

Generally that would slow you down if you wanted to have it all be something like 18.

1 Like

It would be great with a master Radius being the normal: CornerRadius: UDim. While also having the 4 individual corners.

TopLeftCornerRadius: UDim
BottomLeftCornerRadius: UDim
TopRightCornerRadius: UDim
BottomRightCornerRadius: UDim

Meaning the normal CornerRadius would set all of them, and the individual ones being used if needed.

7 Likes

Adding on to this,

I think the same could go for UIStrokes. I’d like to have individual control over those too.,

2 Likes

Just giving this a bump because I find it simply incomprehensible how such a basic, yet critical feature is still not available.

7 Likes

i am begging all gods of roblox engineering please make this a thing

i was in a process of making a transparent inventory hotbar
i quickly found out that i either needed to switch ZIndexBehaviour to Sibling (in order to use CanvasGroups) or that i needed to use images which (big surprise) don’t match the rest of the ui

in the end, you feel nothing but frustration

2 Likes

This is probably not going to be added because of backwards compatibility.
There would be 5 properties:

  • CornerRadius: UDim
  • TopLeftRadius: UDim
  • TopRightRadius: UDim
  • BottomLeftRadius: UDim
  • BottomRightRadius: UDim

Setting CornerRadius would set all the corners to the same thing. Getting CornerRadius would return what you just set it to. But, what if you set each corner indiviually? What should CornerRadius return? The average? The biggest, or smallest? The most recent? A specific corner?

Maybe instead the solution is to have a property which enables the four corner editing, or maybe an UIAdvancedCorner or UIBorder or something dumb like that, to control each corner radius.

1 Like

I think it might be something like other properties or like when you make PartocleEmotters where the colour can change gradually and the text is strange

1 Like

This can be achieved with CanvasGroups with UI corners. they clip ALL descendants even on the corner.

1 Like

?

I meant it can return the CornerRadius kind of the same way Color Graduation does for ParticleEmitters

1 Like

Issue with CanvasGroups is it renders as an image thus reducing the overall quality of the Interface, The thing I hate about roblox the most whenever they do something right they completely screw up something else and this is one of those cases.

4 Likes

About a week ago now, I had made this UI:
IMG_7394

The image has been compressed by Discord and Discourse (twice) at this point so what I’m trying to say might not be very clear, but the text quality is very obviously lower than it should be. If I remember in the morning, I’ll show a comparison, but the point is that having 2 CanvasGroups inside of each other will degrade the quality by a lot.

4 Likes

Bump. I’ve been wanting this ever since UICorner was introduced. There’s so many situations in UI design where you’d only want some of the corners rounded.

This is an old menu I made that would benefit from this:


In this situation I opted to just use custom images with 9Slice because the top and side bars only need 1-2 corners rounded.

2 Likes

Found the solution. Using Udim2 you can set Scale and Pixel values separately

ScaleBorderRadius: Udim2.new(0, 0, 0, 0) TopLeft, TopRight, BottomLeft, BottomRight.
PixelBorderRadius: Udim2.new(0, 0, 0, 0)

Also, Roblox can impliment a solution where just typing the number of BorderRadius inside without fully completing it, Roblox can automatically fill it in similar to AnchorPoint where as you can simply type “0.5” to make it “0.5, 0.5”. However, AnchorPoints use Vector2.new() so there could be a slight difference.

Further more, Roblox can add a RelativeTo property where ScaleBorderRadius will act upon, such as:
XY (Normal)
XX (Y will be replcaed with X scale)
YY (X will be replaced with Y scale)
YX (Normal Inverted)

RelativeTo is a simpler way to not use AspectRatios for Frames.

What if Roblox added a property that lets you choose between them? Ability to change all at once or individual corner?

Code may look like this:

if script.Parent.CornerUI.BorderRadiusType == Enum.BorderRadiusType.Individual then
     return script.Parent.CornerUI.TopLeftCornerRadius
elseif script.Parent.CornerUI.BorderRadiusType == Enum.BorderRadiusType.Combined then
     return script.Parent.CornerUI.CornerRadius
end

UDim2 doesn’t work with UICorner, unless I am minunderstanding something

Yes, but judging the circumstances of extra added properties it would be common to use Udim2.new(), currently no, you’re right, you cannot use Udim2.new() on the current CornerUI.