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

Method scrollCursorToVerticalCenter

texteditor/nav.go:917–921  ·  view source on GitHub ↗

scrollCursorToVerticalCenter tells any parent scroll layout to scroll to get cursor at vert center of view to extent possible -- returns true if scrolled.

()

Source from the content-addressed store, hash-verified

915// cursor at vert center of view to extent possible -- returns true if
916// scrolled.
917func (ed *Editor) scrollCursorToVerticalCenter() bool {
918 curBBox := ed.cursorBBox(ed.CursorPos)
919 mid := (curBBox.Min.Y + curBBox.Max.Y) / 2
920 return ed.scrollToVerticalCenter(mid)
921}
922
923func (ed *Editor) scrollCursorToTarget() {
924 // fmt.Println(ed, "to target:", ed.CursorTarg)

Callers 3

cursorRecenterMethod · 0.95
scrollCursorToTargetMethod · 0.95

Calls 2

cursorBBoxMethod · 0.95

Tested by

no test coverage detected