widget: return float32 coordinates from Editor.CaretCoords

Don't leak the implementation details of the caret coordinates.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-06-20 11:47:46 +02:00
parent 810be77412
commit 2f23a326b8
+4 -4
View File
@@ -468,11 +468,11 @@ func (e *Editor) CaretPos() (line, col int) {
return
}
// CaretCoords returns the x & y coordinates of the caret, relative to the
// CaretCoords returns the coordinates of the caret, relative to the
// editor itself.
func (e *Editor) CaretCoords() (x fixed.Int26_6, y int) {
_, _, x, y = e.layoutCaret()
return
func (e *Editor) CaretCoords() f32.Point {
_, _, x, y := e.layoutCaret()
return f32.Pt(float32(x)/64, float32(y))
}
func (e *Editor) layoutCaret() (carLine, carCol int, x fixed.Int26_6, y int) {