ui: change area ops to use rectangles, not sizes

And then use the more general rectangles to add a buffer around
text.Editor click and scroll area.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-08-01 10:06:19 +02:00
parent d3df90887e
commit bfece0beba
5 changed files with 39 additions and 19 deletions
+7 -1
View File
@@ -248,7 +248,13 @@ func (e *Editor) Layout(cfg ui.Config, queue input.Queue, ops *ui.Ops, cs layout
stack.Pop()
baseline := e.padTop + e.dims.Baseline
pointer.RectAreaOp{Size: e.viewSize}.Add(ops)
pointerPadding := cfg.Px(ui.Dp(4))
r := image.Rectangle{Max: e.viewSize}
r.Min.X -= pointerPadding
r.Min.Y -= pointerPadding
r.Max.X += pointerPadding
r.Max.X += pointerPadding
pointer.RectAreaOp{Rect: r}.Add(ops)
e.scroller.Add(ops)
e.clicker.Add(ops)
return layout.Dimens{Size: e.viewSize, Baseline: baseline}