From 2f23a326b8addca92b0f0b7eebb902432bac90d8 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sat, 20 Jun 2020 11:47:46 +0200 Subject: [PATCH] widget: return float32 coordinates from Editor.CaretCoords Don't leak the implementation details of the caret coordinates. Signed-off-by: Elias Naur --- widget/editor.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/widget/editor.go b/widget/editor.go index f89372fb..041f7308 100644 --- a/widget/editor.go +++ b/widget/editor.go @@ -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) {