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

Non-uniform border mask path overlaps borderRadius #492

Open
macintoshhelper opened this issue Apr 15, 2020 · 4 comments
Open

Non-uniform border mask path overlaps borderRadius #492

macintoshhelper opened this issue Apr 15, 2020 · 4 comments
Labels

Comments

@macintoshhelper
Copy link
Contributor

macintoshhelper commented Apr 15, 2020

| -------------------------------------------------------------------------------------------------

Reporting a bug or issue

The border path polyfill (Border (<position>) mask) for borderLeftWidth, borderRightWidth, etc, for uneven borders, doesn't match the borderRadius of a <View>.

Expected behavior:

image

Observed behavior:

(Example with uneven borderRadius)

image

How to reproduce:

(
  <View
    style={{
      width: 60,
      height: 60,
      borderRadius: 6,
      borderTopLeftRadius: 12,
      borderBottomLeftRadius: 12,
      borderTopRightRadius: 0,
      borderBottomRightRadius: 0,
      borderRightWidth: 0,
      borderLeftWidth: 2,
      borderTopWidth: 2,
      borderBottomWidth: 2,
      borderColor: 'green',
      backgroundColor: 'blue',
    }}
  />
)

Sketch version:

63.1

GitHub Project:

Code that's affected by this issue: https://github.com/elemental-react/primer/blob/918f8f0061e9902ac3bc09e5e28db370e603a912/src/buttons/ButtonGroup.jsx#L12

Can be run from https://github.com/elemental-react/primer/tree/master/examples/sketch

@macintoshhelper macintoshhelper changed the title Border path doesn't match borderRadius for Border (<position>) mask Border mask path overlaps borderRadius Apr 15, 2020
@macintoshhelper macintoshhelper changed the title Border mask path overlaps borderRadius Non-uniform border mask path overlaps borderRadius Apr 15, 2020
@mathieudutour
Copy link
Collaborator

oh interesting. That's actually pretty hard to fix

@macintoshhelper
Copy link
Contributor Author

macintoshhelper commented Apr 17, 2020

The border path masks could be replaced with a single Svg path, that can replace the ShapeGroup rectangle). Would need a function to generate the <Path> data from the rounded corners. Can pass the borderColor into <path fill="#color" and pass in the border width to the path generator function.

@mathieudutour
Copy link
Collaborator

Yeah but when you have just a top border, the path is super weird

@SaiVamshiin
Copy link

You can try adjusting the values of the border-radius property to see if you can find a combination that works with the border path polyfill.

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

No branches or pull requests

3 participants