Layout clips to the dimensions of the selectable, updates the shaped text, configures input handling, and paints the text and selection rectangles. The provided textMaterial and selectionMaterial ops are used to set the paint material for the text and selection rectangles, respectively.
(gtx layout.Context, lt *text.Shaper, font font.Font, size unit.Sp, textMaterial, selectionMaterial op.CallOp)
| 182 | // the text and selection rectangles. The provided textMaterial and selectionMaterial ops are used to set the |
| 183 | // paint material for the text and selection rectangles, respectively. |
| 184 | func (l *Selectable) Layout(gtx layout.Context, lt *text.Shaper, font font.Font, size unit.Sp, textMaterial, selectionMaterial op.CallOp) layout.Dimensions { |
| 185 | l.Update(gtx) |
| 186 | l.text.LineHeight = l.LineHeight |
| 187 | l.text.LineHeightScale = l.LineHeightScale |
| 188 | l.text.Alignment = l.Alignment |
| 189 | l.text.MaxLines = l.MaxLines |
| 190 | l.text.Truncator = l.Truncator |
| 191 | l.text.WrapPolicy = l.WrapPolicy |
| 192 | l.text.Layout(gtx, lt, font, size) |
| 193 | dims := l.text.Dimensions() |
| 194 | defer clip.Rect(image.Rectangle{Max: dims.Size}).Push(gtx.Ops).Pop() |
| 195 | pointer.CursorText.Add(gtx.Ops) |
| 196 | event.Op(gtx.Ops, l) |
| 197 | |
| 198 | l.clicker.Add(gtx.Ops) |
| 199 | l.dragger.Add(gtx.Ops) |
| 200 | |
| 201 | l.paintSelection(gtx, selectionMaterial) |
| 202 | l.paintText(gtx, textMaterial) |
| 203 | return dims |
| 204 | } |
| 205 | |
| 206 | func (l *Selectable) handleEvents(gtx layout.Context) (selectionChanged bool) { |
| 207 | oldStart, oldLen := min(l.text.Selection()), l.text.SelectionLen() |
nothing calls this directly
no test coverage detected