-
Notifications
You must be signed in to change notification settings - Fork 563
Support in <Group /> for saveLayerFlags and backdrop #3610
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
base: main
Are you sure you want to change the base?
Changes from all commits
0b07047
9ed6d93
9741173
5263be9
399d86b
fc6edf3
e4be3c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,14 +8,27 @@ export interface PublicGroupProps extends Omit<GroupProps, "layer"> { | |
| layer?: GroupProps["layer"] | ChildrenProps["children"]; | ||
| } | ||
|
|
||
| export const Group = ({ layer, ...props }: SkiaProps<PublicGroupProps>) => { | ||
| export const Group = ({ | ||
| layer, | ||
| backdropFilter, | ||
| saveLayerFlags, | ||
| ...props | ||
| }: SkiaProps<PublicGroupProps>) => { | ||
|
Comment on lines
+11
to
+16
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it would be really nice if we could pass a child node to the backdropFilter prop. (Similar to the layer prop - that accepts an SkPaint object or a I couldn't quite work out how to do this without a big change to the node visitor. I think this dual support for the Because the nodes that would be supported in The features still works by passing an SkImageFilter only, we could revisit this later. |
||
| if (isValidElement(layer) && typeof layer === "object") { | ||
| return ( | ||
| <skLayer> | ||
| // keep the saveLayerFlags on whichever node triggers saveLayer | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a little awkward, but I tracked everywhere in the graph traversal that ends up calling saveLayer. The Paint props on group must also be provided to saveLayer, so I decided it is safe if I always store the flag prop alongside the BTW I think I found that this Edit: this split creates a surprising gap in test coverage, the execution path when passing an SkPaint or a |
||
| <skLayer backdropFilter={backdropFilter} saveLayerFlags={saveLayerFlags}> | ||
| {layer} | ||
| <skGroup {...props} /> | ||
| </skLayer> | ||
| ); | ||
| } | ||
| return <skGroup layer={layer as GroupProps["layer"]} {...props} />; | ||
| return ( | ||
| <skGroup | ||
| layer={layer as GroupProps["layer"]} | ||
| backdropFilter={backdropFilter} | ||
| saveLayerFlags={saveLayerFlags} | ||
| {...props} | ||
| /> | ||
| ); | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SaveLayerFlag being a union is a little awkward since this can actually be a bitset OR of any of the flags. But this problem seems to exist elsewhere in the library. Another option is one boolean property per flag, but then we just have to unpack that everywhere, so it may not be worthwhile.