@@ -89,6 +89,9 @@ impl FunctionLayer {
8989 c. rotate ( ( 90.0f64 ) . to_radians ( ) ) ;
9090 let button_width = DFR_WIDTH as f64 / ( self . buttons . len ( ) + 1 ) as f64 ;
9191 let spacing_width = ( DFR_WIDTH as f64 - self . buttons . len ( ) as f64 * button_width) / ( self . buttons . len ( ) + 1 ) as f64 ;
92+ let radius = 8.0f64 ;
93+ let bot = 0.09 * DFR_HEIGHT as f64 + radius;
94+ let top = bot + 0.82 * DFR_HEIGHT as f64 - 2.0 * radius;
9295 c. set_source_rgb ( 0.0 , 0.0 , 0.0 ) ;
9396 c. paint ( ) . unwrap ( ) ;
9497 c. select_font_face ( "sans-serif" , FontSlant :: Normal , FontWeight :: Normal ) ;
@@ -97,7 +100,40 @@ impl FunctionLayer {
97100 let left_edge = i as f64 * ( button_width + spacing_width) + spacing_width;
98101 let color = if active_buttons[ i] { BUTTON_COLOR_ACTIVE } else { BUTTON_COLOR_INACTIVE } ;
99102 c. set_source_rgb ( color, color, color) ;
100- c. rectangle ( left_edge, 0.09 * DFR_HEIGHT as f64 , button_width, 0.82 * DFR_HEIGHT as f64 ) ;
103+ // draw box with rounded corners
104+ c. new_sub_path ( ) ;
105+ let left = left_edge + radius;
106+ let right = left_edge + button_width - radius;
107+ c. arc (
108+ right,
109+ bot,
110+ radius,
111+ ( -90.0f64 ) . to_radians ( ) ,
112+ ( 0.0f64 ) . to_radians ( ) ,
113+ ) ;
114+ c. arc (
115+ right,
116+ top,
117+ radius,
118+ ( 0.0f64 ) . to_radians ( ) ,
119+ ( 90.0f64 ) . to_radians ( ) ,
120+ ) ;
121+ c. arc (
122+ left,
123+ top,
124+ radius,
125+ ( 90.0f64 ) . to_radians ( ) ,
126+ ( 180.0f64 ) . to_radians ( ) ,
127+ ) ;
128+ c. arc (
129+ left,
130+ bot,
131+ radius,
132+ ( 180.0f64 ) . to_radians ( ) ,
133+ ( 270.0f64 ) . to_radians ( ) ,
134+ ) ;
135+ c. close_path ( ) ;
136+
101137 c. fill ( ) . unwrap ( ) ;
102138 c. set_source_rgb ( 1.0 , 1.0 , 1.0 ) ;
103139 let extents = c. text_extents ( & button. text ) . unwrap ( ) ;
0 commit comments