tabris-js
tabris-js copied to clipboard
Allow to set cornerRadius on a per corner basis
Problem description
Currently setting the cornerRadius
affects all corners equally. It would be handy to affect only a particular corner. This could be used to eg create rounded "tabs" on a custom tab folder.
Expected behavior
Allow to set cornerRadius
on a per corner basis with similar flexibility as padding
.
Environment
- Tabris.js version: 3.0
Can this be added to 3.3 milestone?
Any news?
It will not make the cut for 3.3 (due next week) but we will revisit it for the next release.
@mpost Please make this part of the 3.6 milestone. This issue is more than a year old and it is very annoying in many scenarios.
We have conducted some research to bring corner specific roundings to Android. It is not possible with native android means that we currently use. One option would be to use com.google.android.material.shape.MaterialShapeDrawable
which is a special drawable that could be applied on the backround. Unfortunately the fake shadow quality is no very good and clipping would not occur as it does right now. in fact the parent would need to have its clipChildren
be set to false.
@mpost Let's just make a comparison
Android Native | MaterialShapeDrawable | |
---|---|---|
Outline | - | + |
Shadow color | - | + |
Rounding for each corner | - | + |
Shadow direction | - | + |
Color filters | + | + |
Shadow quality | Good | Poor (can use native) |
@fax1ty It is not that simple. You are missing the clipping feature of the current cornerRadius
. With the MaterialShapeDrawable
you do not get any clipping with shapes that could not be covered by the ViewOutlineProvider
(basically only concave shapes). Therefore a switch to the material drawable would break this behavior by not applying clipping correctly.
In addition the MaterialShapeDrawable
is an drawable which would replace any other drawable that would be set as the current background (eg a color or gradient drawable) so the current tabris apis would need to be retrofited to work with the MaterialShapeDrawable
.