MCPcopy Create free account
hub / github.com/cogentcore/core / scrollToWidget

Method scrollToWidget

core/scroll.go:285–292  ·  view source on GitHub ↗

scrollToWidget scrolls the layout to ensure that the given widget is in view. It returns whether scrolling was needed.

(w Widget)

Source from the content-addressed store, hash-verified

283// scrollToWidget scrolls the layout to ensure that the given widget is in view.
284// It returns whether scrolling was needed.
285func (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.

Callers 1

ScrollToThisMethod · 0.80

Calls 4

ScrollToBoxMethod · 0.95
totalRectMethod · 0.80
AsWidgetMethod · 0.65
SizeMethod · 0.65

Tested by

no test coverage detected