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

[Catalyst] Fix brushes in Frame #7925

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Compatibility/Core/src/iOS/Renderers/FrameRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ public virtual void SetupLayer()
public override void LayoutSubviews()
{
if (_previousSize != Bounds.Size)
{
SetNeedsDisplay();
this.UpdateBackgroundLayer();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're modifying the compatibility renderer should this call get moved up to here?

https://github.com/dotnet/maui/blob/main/src/Controls/src/Core/Compatibility/Handlers/iOS/VisualElementRenderer.cs#L10

}

base.LayoutSubviews();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
<Label
Text="Only with BackgroundColor" />
</Frame>
<Label
Text="Background"
Style="{StaticResource Headline}"/>
<Frame>
<Frame.Background>
<LinearGradientBrush EndPoint="1,0">
<GradientStop Color="Yellow"
Offset="0.1" />
<GradientStop Color="Green"
Offset="1.0" />
</LinearGradientBrush>
</Frame.Background>
<Label
Text="Background" />
</Frame>
<Label
Text="BorderColor"
Style="{StaticResource Headline}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ void UpdateShadow()
public override void LayoutSubviews()
{
if (_previousSize != Bounds.Size)
{
SetNeedsDisplay();
this.UpdateBackgroundLayer();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting a little bit lost on this PR.

We have a call here that's supposed to update the background layer. But that calls UpdateBackgroundLayerFrame where as this calls UpdateBackgroundLayer. It seems like the controls layer generally needs a call into UpdateBackgroundLayer and that this isn't specific to just the FrameRenderer. To fix this should we instead add a mapping addition at the controls layer to Frame that calls UpgradeBackgroundLayer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is similar. This PR apply changes to update the Frame background layer with size changes. Because the Frame continue using a Renderer, the changes are applied directly to the Renderer code.

Copy link
Member

@PureWeen PureWeen Nov 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is using the handler based VisualElementRenderer though it's not a compatibility renderer so it's based on IVEH

Should this code go inside this class?

https://github.com/dotnet/maui/blob/main/src/Controls/src/Core/Compatibility/Handlers/iOS/VisualElementRenderer.cs#L10

The old renderer had it and it seems like it didn't get copied over?

https://github.com/dotnet/maui/blob/main/src/Compatibility/Core/src/iOS/VisualElementRenderer.cs#L258-L259

image

}

base.LayoutSubviews();
}
Expand Down