@@ -22,14 +22,14 @@ fn rounded_box_sdf(to_center: vec2<f32>, size: vec2<f32>, radius: f32) -> f32 {
2222 return length (max (abs (to_center ) - size + vec2 <f32 >(radius , radius ), vec2 <f32 >(0 .0 , 0 .0 ))) - radius ;
2323}
2424
25- // Based on the fragment position and the center of the quad, select one of the 4 radi .
25+ // Based on the fragment position and the center of the quad, select one of the 4 radii .
2626// Order matches CSS border radius attribute:
27- // radi .x = top-left, radi .y = top-right, radi .z = bottom-right, radi .w = bottom-left
28- fn select_border_radius (radi : vec4 <f32 >, position : vec2 <f32 >, center : vec2 <f32 >) -> f32 {
29- var rx = radi . x ;
30- var ry = radi . y ;
31- rx = select (radi . x , radi . y , position . x > center . x );
32- ry = select (radi . w , radi . z , position . x > center . x );
27+ // radii .x = top-left, radii .y = top-right, radii .z = bottom-right, radii .w = bottom-left
28+ fn select_border_radius (radii : vec4 <f32 >, position : vec2 <f32 >, center : vec2 <f32 >) -> f32 {
29+ var rx = radii . x ;
30+ var ry = radii . y ;
31+ rx = select (radii . x , radii . y , position . x > center . x );
32+ ry = select (radii . w , radii . z , position . x > center . x );
3333 rx = select (rx , ry , position . y > center . y );
3434 return rx ;
3535}
0 commit comments