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

Image mask causing image to be hidden behind other SVG elements #574

Closed
chopfitzroy opened this issue Nov 16, 2023 · 2 comments
Closed

Image mask causing image to be hidden behind other SVG elements #574

chopfitzroy opened this issue Nov 16, 2023 · 2 comments

Comments

@chopfitzroy
Copy link

chopfitzroy commented Nov 16, 2023

Bug report

Description / Observed Behavior

What kind of issues did you encounter with Satori?

Child img elements of elements that use the maskImage style prop are being hidden behind one of the SVG elements.

Screenshots of the problematic SVG element:

SVG element SVG element removed
Screenshot 2023-11-16 at 8 28 17 PM Screenshot 2023-11-16 at 8 28 25 PM

Expected Behavior

How did you expect Satori to behave here?

That the image would show the same way it does in the browser (or the Native tab in the Satori playground).

Reproduction

Link.

Additional Context

Satori version, and any other context about the problem here.

Satori version: "satori": "^0.10.9".

I tried installing both of the following branches as they include updates to masking:

Neither rendered the results I wanted.

I also tried a variation of the code where I removed the absolutely position child and applied the mask to the parent.

This also works in the browser / Native tab in the satori playground, but seemed to break the SVG render even more:

Expand alternate code sample
() => {
  //...
  return (
    <div style={{
      width: 400,
      height: 400,
      display: 'flex',
      overflow: 'hidden',
      position: 'relative',
      alignItems: 'center',
      justifyContent: 'center',
      maskImage: `url(${props.mask})`,
      maskRepeat: 'no-repeat',
      WebkitMaskImage: `url(${props.mask})`,
      WebkitMaskRepeat: 'no-repeat',
    }}>
        <img src={submission.portrait} style={{
        top: submission.x,
        left: submission.y,
        position: 'absolute',
        maxWidth: CANVAS_WIDTH,
        maxHeight: CANVAS_HEIGHT,
        transform: `scale(${zoom})`,
      }} />
      <div style={{
        width: BORDER_WIDTH,
        height: BORDER_HEIGHT,
        backgroundSize: 'cover',
        backgroundImage: `url(${props.border})`,
        backgroundRepeat: 'no-repeat'
      }}>
      </div>
    </div>
  )
}
@chopfitzroy chopfitzroy changed the title Image mask seems to ignore image Image mask causing image to be hidden behind other SVG elements Nov 16, 2023
@chopfitzroy
Copy link
Author

Luminance will work and thank you for linking the relevant issue 😄

Happy to consider this closed! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants