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

Fix a bug in the corner radius overlap calculation. #2286

Merged
merged 1 commit into from Jan 14, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Fix a bug in the corner radius overlap calculation.

  • Loading branch information
mstange committed Jan 11, 2018
commit 338583e8e7ffb0b106c91020748b6c9525074669
@@ -237,12 +237,12 @@ pub fn ensure_no_corner_overlap(
let bottom_right_radius = &mut radius.bottom_right;
let bottom_left_radius = &mut radius.bottom_left;

let sum = top_left_radius.width + bottom_left_radius.width;
let sum = top_left_radius.width + top_right_radius.width;
if rect.size.width < sum {
ratio = f32::min(ratio, rect.size.width / sum);
}

let sum = top_right_radius.width + bottom_right_radius.width;
let sum = bottom_left_radius.width + bottom_right_radius.width;
if rect.size.width < sum {
ratio = f32::min(ratio, rect.size.width / sum);
}
@@ -0,0 +1,113 @@
---
root:
items:
- type: stacking-context
bounds: [0, 0, 1000, 1000]
items:
- type: clip
bounds: [ 50, 50, 200, 100 ]
complex:
- rect: [ 50, 50, 200, 100 ]
radius:
top-left: [200, 100]
top-right: [0, 0]
bottom-left: [0, 0]
bottom-right: [0, 0]
items:
- type: rect
bounds: [ 50, 50, 200, 100 ]
color: blue
- type: clip
bounds: [ 50, 150, 200, 100 ]
complex:
- rect: [ 50, 150, 200, 100 ]
radius:
top-left: [0, 0]
top-right: [0, 0]
bottom-left: [200, 100]
bottom-right: [0, 0]
items:
- type: rect
bounds: [ 50, 150, 200, 100 ]
color: blue

- type: clip
bounds: [ 300, 50, 100, 200 ]
complex:
- rect: [ 300, 50, 100, 200 ]
radius:
top-left: [100, 200]
top-right: [0, 0]
bottom-left: [0, 0]
bottom-right: [0, 0]
items:
- type: rect
bounds: [ 300, 50, 100, 200 ]
color: green
- type: clip
bounds: [ 400, 50, 100, 200 ]
complex:
- rect: [ 400, 50, 100, 200 ]
radius:
top-left: [0, 0]
top-right: [100, 200]
bottom-left: [0, 0]
bottom-right: [0, 0]
items:
- type: rect
bounds: [ 400, 50, 100, 200 ]
color: green

- type: clip
bounds: [ 50, 300, 200, 100 ]
complex:
- rect: [ 50, 300, 200, 100 ]
radius:
top-left: [0, 0]
top-right: [200, 100]
bottom-left: [0, 0]
bottom-right: [0, 0]
items:
- type: rect
bounds: [ 50, 300, 200, 100 ]
color: red
- type: clip
bounds: [ 50, 400, 200, 100 ]
complex:
- rect: [ 50, 400, 200, 100 ]
radius:
top-left: [0, 0]
top-right: [0, 0]
bottom-left: [0, 0]
bottom-right: [200, 100]
items:
- type: rect
bounds: [ 50, 400, 200, 100 ]
color: red

- type: clip
bounds: [ 300, 300, 100, 200 ]
complex:
- rect: [ 300, 300, 100, 200 ]
radius:
top-left: [0, 0]
top-right: [0, 0]
bottom-left: [100, 200]
bottom-right: [0, 0]
items:
- type: rect
bounds: [ 300, 300, 100, 200 ]
color: yellow
- type: clip
bounds: [ 400, 300, 100, 200 ]
complex:
- rect: [ 400, 300, 100, 200 ]
radius:
top-left: [0, 0]
top-right: [0, 0]
bottom-left: [0, 0]
bottom-right: [100, 200]
items:
- type: rect
bounds: [ 400, 300, 100, 200 ]
color: yellow
@@ -0,0 +1,61 @@
---
root:
items:
- type: stacking-context
bounds: [0, 0, 1000, 1000]
items:
- type: clip
bounds: [ 50, 50, 200, 200 ]
complex:
- rect: [ 50, 50, 200, 200 ]
radius:
top-left: [200, 100]
top-right: [0, 0]
bottom-left: [200, 100]
bottom-right: [0, 0]
items:
- type: rect
bounds: [ 50, 50, 200, 200 ]
color: blue

- type: clip
bounds: [ 300, 50, 200, 200 ]
complex:
- rect: [ 300, 50, 200, 200 ]
radius:
top-left: [100, 200]
top-right: [100, 200]
bottom-left: [0, 0]
bottom-right: [0, 0]
items:
- type: rect
bounds: [ 300, 50, 200, 200 ]
color: green

- type: clip
bounds: [ 50, 300, 200, 200 ]
complex:
- rect: [ 50, 300, 200, 200 ]
radius:
top-left: [0, 0]
top-right: [200, 100]
bottom-left: [0, 0]
bottom-right: [200, 100]
items:
- type: rect
bounds: [ 50, 300, 200, 200 ]
color: red

- type: clip
bounds: [ 300, 300, 200, 200 ]
complex:
- rect: [ 300, 300, 200, 200 ]
radius:
top-left: [0, 0]
top-right: [0, 0]
bottom-left: [100, 200]
bottom-right: [100, 200]
items:
- type: rect
bounds: [ 300, 300, 200, 200 ]
color: yellow
@@ -2,3 +2,4 @@
== clip-ellipse.yaml clip-ellipse.png
== clip-45-degree-rotation.yaml clip-45-degree-rotation-ref.png
== clip-3d-transform.yaml clip-3d-transform-ref.yaml
== clip-corner-overlap.yaml clip-corner-overlap-ref.yaml
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.