maui icon indicating copy to clipboard operation
maui copied to clipboard

[iOS] Fix Border Content clipping issues

Open jsuarezruiz opened this issue 3 years ago • 12 comments

Description of Change

Fix Border Content clipping issues.

fix-clipping-ios-1 fix-clipping-ios-2

(Draft PR, still completing testing)

Issues Fixed

Fixes #10724 Fixes #7521 Fixes #10478 Fixes #12580 Fixes #9952 Fixes #9081 FIxes #13388

jsuarezruiz avatar Oct 27 '22 17:10 jsuarezruiz

Testing with the original posters XAML and the results seem off

 <VerticalStackLayout>
        <Border StrokeThickness="20"
                            Stroke="Silver"
                            Background="White"
                            Margin="0"
                            Padding="0">
            <Border.StrokeShape>
                <RoundRectangle CornerRadius="30" />
            </Border.StrokeShape>
            <Grid HeightRequest="30" BackgroundColor="Green">
                <StackLayout Orientation="Horizontal">
                    <Frame Padding="0" HasShadow="false"
                                       BackgroundColor="Maroon"
                                       CornerRadius="20"
                                       HeightRequest="40"
                                       WidthRequest="40" VerticalOptions="Center" >
                    </Frame>
                    <Label Text="Parameters"
                                       VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
                                       FontSize="Medium" FontFamily="Bold"
                                       HorizontalTextAlignment="Center" VerticalTextAlignment="Center" />
                    <Frame Padding="0" HasShadow="false" CornerRadius="0" Margin="0,0,-20,0"
                                       BackgroundColor="Blue"
                                       HeightRequest="40"
                                       WidthRequest="40" VerticalOptions="Center" >
                    </Frame>
                </StackLayout>
            </Grid>
        </Border>
    </VerticalStackLayout>

image

Tested with Catalyst and the result is the same as Android. Weird, will do more tests. image

jsuarezruiz avatar Nov 22 '22 12:11 jsuarezruiz

Windows seems doesn't render the frames..

image

rmarinho avatar Nov 28 '22 14:11 rmarinho

IMG_1642

on IOS is almost fine, theres some white background

rmarinho avatar Nov 28 '22 16:11 rmarinho

Testing with the original posters XAML and the results seem off

 <VerticalStackLayout>
        <Border StrokeThickness="20"
                            Stroke="Silver"
                            Background="White"
                            Margin="0"
                            Padding="0">
            <Border.StrokeShape>
                <RoundRectangle CornerRadius="30" />
            </Border.StrokeShape>
            <Grid HeightRequest="30" BackgroundColor="Green">
                <StackLayout Orientation="Horizontal">
                    <Frame Padding="0" HasShadow="false"
                                       BackgroundColor="Maroon"
                                       CornerRadius="20"
                                       HeightRequest="40"
                                       WidthRequest="40" VerticalOptions="Center" >
                    </Frame>
                    <Label Text="Parameters"
                                       VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
                                       FontSize="Medium" FontFamily="Bold"
                                       HorizontalTextAlignment="Center" VerticalTextAlignment="Center" />
                    <Frame Padding="0" HasShadow="false" CornerRadius="0" Margin="0,0,-20,0"
                                       BackgroundColor="Blue"
                                       HeightRequest="40"
                                       WidthRequest="40" VerticalOptions="Center" >
                    </Frame>
                </StackLayout>
            </Grid>
        </Border>
    </VerticalStackLayout>

image

Alright, I think the key piece of information I was missing here is that you need to rebase to see these results. If I rebase this PR to main then I get the incorrect layout described here.

Here it is running on catalyst with everything rebased to main

image

PureWeen avatar Jan 09 '23 17:01 PureWeen

Testing with the original posters XAML and the results seem off

 <VerticalStackLayout>
        <Border StrokeThickness="20"
                            Stroke="Silver"
                            Background="White"
                            Margin="0"
                            Padding="0">
            <Border.StrokeShape>
                <RoundRectangle CornerRadius="30" />
            </Border.StrokeShape>
            <Grid HeightRequest="30" BackgroundColor="Green">
                <StackLayout Orientation="Horizontal">
                    <Frame Padding="0" HasShadow="false"
                                       BackgroundColor="Maroon"
                                       CornerRadius="20"
                                       HeightRequest="40"
                                       WidthRequest="40" VerticalOptions="Center" >
                    </Frame>
                    <Label Text="Parameters"
                                       VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
                                       FontSize="Medium" FontFamily="Bold"
                                       HorizontalTextAlignment="Center" VerticalTextAlignment="Center" />
                    <Frame Padding="0" HasShadow="false" CornerRadius="0" Margin="0,0,-20,0"
                                       BackgroundColor="Blue"
                                       HeightRequest="40"
                                       WidthRequest="40" VerticalOptions="Center" >
                    </Frame>
                </StackLayout>
            </Grid>
        </Border>
    </VerticalStackLayout>

image

Alright, I think the key piece of information I was missing here is that you need to rebase to see these results. If I rebase this PR to main then I get the incorrect layout described here.

Here it is running on catalyst with everything rebased to main

image

Ok, thanks for the details. Let me test it.

jsuarezruiz avatar Jan 11 '23 15:01 jsuarezruiz

Added more samples to validate #9081 Captura de pantalla 2023-01-27 a las 14 25 10

jsuarezruiz avatar Jan 27 '23 13:01 jsuarezruiz

@jsuarezruiz Is there any chance that this fix will be available in the NET 7.200 version?

KSemenenko avatar Feb 01 '23 10:02 KSemenenko

:warning: Your code has been reformatted. :warning:

github-actions[bot] avatar Feb 14 '23 16:02 github-actions[bot]

Just ran the sample gallery from this PR, and it looks like it's clipping the items on the first page: Simulator Screen Shot - iPhone 12 Pro - 2023-02-15 at 13 22 18

hartez avatar Feb 15 '23 20:02 hartez

Just ran the sample gallery from this PR, and it looks like it's clipping the items on the first page: Simulator Screen Shot - iPhone 12 Pro - 2023-02-15 at 13 22 18

Working on changes. Detected the issue. This PR is before these changes https://github.com/dotnet/maui/pull/12356 and for the clipping is still using the old Shapes sizing approach setting the Frame etc. This is wrong and require changes.

This PR is marked as Draft while updating the code.

jsuarezruiz avatar Feb 17 '23 13:02 jsuarezruiz

Just ran the sample gallery from this PR, and it looks like it's clipping the items on the first page: Simulator Screen Shot - iPhone 12 Pro - 2023-02-15 at 13 22 18

Working on changes. Detected the issue. This PR is before these changes #12356 and for the clipping is still using the old Shapes sizing approach setting the Frame etc. This is wrong and require changes.

This PR is marked as Draft while updating the code.

Ready to another review. Applied changes and tested with the original issue sample: Captura de pantalla 2023-02-20 a las 13 52 20

Of course, with the .NET MAUI gallery: Captura de pantalla 2023-02-20 a las 13 48 18

And with the specific sample to validate the Border clipping possibilities (with different shapes, stroke width etc). fix-border-clip-ios

jsuarezruiz avatar Feb 20 '23 13:02 jsuarezruiz

If I open the "Border Stroke Options" page and update each Label to have a HeightRequest of 50, I get this, which seems wrong: Simulator Screen Shot - iPhone 12 Pro - 2023-02-22 at 16 02 44

hartez avatar Feb 22 '23 23:02 hartez

Border widths still look wrong for iOS on the Border Stroke Options page.

Seems that this will be fixed by https://github.com/dotnet/maui/pull/14114 Let's review it again after merge 14114 and rebase here.

jsuarezruiz avatar Mar 22 '23 08:03 jsuarezruiz

I merged main with changes of #14114 and the border with height works ok now

rmarinho avatar Mar 22 '23 12:03 rmarinho

Would be massively in favour of a backport of these fixes!

breenbob avatar Jun 29 '23 09:06 breenbob

Couldn't agree more, for whatever it's worth.

jcsnider avatar Jun 29 '23 09:06 jcsnider

I am still having the problem. Hope the fix will be available soon.

jrahma avatar Jul 10 '23 14:07 jrahma

Would be massively in favour of a backport of these fixes!

Agree. Hope we get the fix soon in .Net 7.

darshanio avatar Jul 11 '23 10:07 darshanio

Sorry if this is a dumb question, but will these changes be in the next update? When can I expect an update and where can I see what happens in a future update?

K0Ma19 avatar Jul 18 '23 14:07 K0Ma19

I feel it will be .NET 8 preview 7 or so

KSemenenko avatar Jul 18 '23 15:07 KSemenenko