diff --git a/src/ui/painter.rs b/src/ui/painter.rs index 702e1c8..90b221a 100644 --- a/src/ui/painter.rs +++ b/src/ui/painter.rs @@ -35,17 +35,24 @@ impl<'a> Painter<'a> { ctx.theme_border(&self.theme); ctx.stroke().unwrap(); - // ctx.reset_clip(); - // // finally, clip any future content so the border stays alive + self.border_clip(); + } + + pub fn border_clip(&self) + { + let ctx = self.context; + + ctx.reset_clip(); + // clip any future content so the border stays alive let (x1,y1,x2,y2) = ctx.clip_extents().unwrap(); // the path of the clip - // // region, i.e. the surface + // region, i.e. the surface debug!{"Border extent: {},{},{},{}", x1, y1, x2, y2}; let border = self.theme.border(ctx); // width of the border, note - // that half of the border is outside - // the clip_extents + // that half of the border is outside + // the clip_extents -// let (x1,y1,x2,y2) = (x1+border, y1+border, x2-border, y2-border); + // let (x1,y1,x2,y2) = (x1+border, y1+border, x2-border, y2-border); debug!{"Border rect: {},{},{},{}", x1, y1, x2, y2}; let (x1,y1,x2,y2) = (x1+border,y1+border,x2-x1-border,y2-y1-border-border); debug!{"Border clip: {},{},{},{}", x1, y1, x2, y2}; diff --git a/src/ui/ui.rs b/src/ui/ui.rs index 76d096a..6610f27 100644 --- a/src/ui/ui.rs +++ b/src/ui/ui.rs @@ -96,6 +96,7 @@ pub fn redraw_quick(window: &Window, result: Vec<(&Entry, Vec)>, selectio context.scale(30.0, 30.0); let painter = painter::Painter::new(&context); + painter.border_clip(); result.iter().enumerate() .for_each(|(i, r)| {