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

Method cursorBBox

texteditor/cursor.go:76–83  ·  view source on GitHub ↗

cursorBBox returns a bounding-box for a cursor at given position

(pos lexer.Pos)

Source from the content-addressed store, hash-verified

74
75// cursorBBox returns a bounding-box for a cursor at given position
76func (ed *Editor) cursorBBox(pos lexer.Pos) image.Rectangle {
77 cpos := ed.charStartPos(pos)
78 cbmin := cpos.SubScalar(ed.CursorWidth.Dots)
79 cbmax := cpos.AddScalar(ed.CursorWidth.Dots)
80 cbmax.Y += ed.fontHeight
81 curBBox := image.Rectangle{cbmin.ToPointFloor(), cbmax.ToPointCeil()}
82 return curBBox
83}
84
85// renderCursor renders the cursor on or off, as a sprite that is either on or off
86func (ed *Editor) renderCursor(on bool) {

Callers 6

scrollCursorToTopMethod · 0.95
scrollCursorToBottomMethod · 0.95
scrollCursorToRightMethod · 0.95
pasteHistoryMethod · 0.95

Calls 5

charStartPosMethod · 0.95
ToPointFloorMethod · 0.80
ToPointCeilMethod · 0.80
SubScalarMethod · 0.45
AddScalarMethod · 0.45

Tested by

no test coverage detected