Skip to content
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

Padding (and even children Margin) clips children on Android #12877

Closed
roubachof opened this issue Jul 12, 2023 · 8 comments · Fixed by #13010
Closed

Padding (and even children Margin) clips children on Android #12877

roubachof opened this issue Jul 12, 2023 · 8 comments · Fixed by #13010
Assignees
Labels
area/shadows Categorizes an issue or PR as relevant to shadows difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working project/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..) triage/untriaged Indicates an issue requires triaging or verification

Comments

@roubachof
Copy link

roubachof commented Jul 12, 2023

Current behavior

It seems that when setting Padding on a parent view, it clips children on android, whereas on other platform it does not clip the children.

Expected behavior

Padding and margin should behave consistently between platform hence android shouldn't clip child when using padding or child margin.

How to reproduce it (as minimally and precisely as possible)

Launch Uno toolkit winui sample, and select the ShadowContainer sample, from this branch:
unoplatform/uno.toolkit.ui#571

Screenshot_1689174238

you will see that the first "Neumorphism" card is clipped by its parent padding

   <StackPanel Width="400"
                        Margin="0,32"
                        Padding="32"
                        Background="{StaticResource UnoColor}"
                        CornerRadius="30">
                <ui:ShadowContainer Shadows="{StaticResource NeumorphismRaising}">
                    <Grid Width="300"
                          Padding="20"
                          Background="{StaticResource UnoColor}"
                          CornerRadius="20">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="20" />
                            <RowDefinition Height="20" />
                        </Grid.RowDefinitions>

                        <TextBlock FontSize="15"
                                   Foreground="White"
                                   Text="Neumorphism" />
                        <TextBlock Grid.Row="1"
                                   FontSize="12"
                                   Foreground="White"
                                   Text="Raising element" />
                    </Grid>
                </ui:ShadowContainer>

on Windows and iOS, the children shadows are not clipped.
windows_padding
ios_padding

remark: Shadows are implement by a SKXamlCanvas .

Workaround

No response

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

Uno.WinUI 4.7.37, 4.9.26
SkiaSharp.Views.Uno.WinUI 2.88.3

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

@roubachof roubachof added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Jul 12, 2023
@agneszitte
Copy link
Contributor

@roubachof tested and said it was the same using latest Uno 5.0.0-dev.1380

@agneszitte agneszitte added project/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..) area/shadows Categorizes an issue or PR as relevant to shadows labels Jul 12, 2023
@carldebilly
Copy link
Member

@roubachof On Android, I'm having far worse result...

image

@roubachof
Copy link
Author

Yup this is another issue: a regression on layout with uno 5, it also impact ios.
You can either try it with version < 5, or toggle the theming to force a new layout pass and have the correct result (with bad padding :).

@jeromelaban
Copy link
Member

jeromelaban commented Jul 17, 2023

@roubachof could you create another issue with a before/after issue for that particular layout problem that is a regression? We're going to need to look at it separately. This issue may also still be blocked by the fact that we can't debug on android properly at this time.

@eriklimakc
Copy link
Contributor

On WASM there is clipping as well, but it looks different from Android. Could it be related?

image

@eriklimakc
Copy link
Contributor

About the WASM clipping, on SkiaSharp 2.88.4-preview.84 we get a better result:

image

@jeromelaban
Copy link
Member

There's still a little bit of clipping, but it's a lot better for sure.

@roubachof
Copy link
Author

This is in fact the same clipping, but since the fix I created for wasm was integrated in 2.88.4-preview (mono/SkiaSharp#2443), you have now the correct shadow color, which is softer and doesn't enlighten the wasm clipping so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/shadows Categorizes an issue or PR as relevant to shadows difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working project/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..) triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants