scrollToWidget scrolls the layout to ensure that the given widget is in view. It returns whether scrolling was needed.
(w Widget)
| 283 | // scrollToWidget scrolls the layout to ensure that the given widget is in view. |
| 284 | // It returns whether scrolling was needed. |
| 285 | func (fr *Frame) scrollToWidget(w Widget) bool { |
| 286 | // note: critical to NOT use BBox b/c it is zero for invisible items! |
| 287 | box := w.AsWidget().Geom.totalRect() |
| 288 | if box.Size() == (image.Point{}) { |
| 289 | return false |
| 290 | } |
| 291 | return fr.ScrollToBox(box) |
| 292 | } |
| 293 | |
| 294 | // autoScrollDim auto-scrolls along one dimension, based on the current |
| 295 | // position value, which is in the current scroll value range. |
no test coverage detected