From 51e3b68908515037615a3d8622af852392068eaa Mon Sep 17 00:00:00 2001 From: "Randall C. O'Reilly" Date: Thu, 25 Sep 2025 13:01:28 +0200 Subject: [PATCH 1/3] scroll: first pass attempt --- core/text.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/text.go b/core/text.go index 60e612330f..88e693803f 100644 --- a/core/text.go +++ b/core/text.go @@ -262,6 +262,8 @@ func (tx *Text) Init() { tx.NeedsRender() }) tx.On(events.SlideStop, func(e events.Event) { + tx.SetState(false, states.Sliding) + tx.parentWidget().SetFocusQuiet() if TheApp.SystemPlatform().IsMobile() { tx.Send(events.ContextMenu, e) } From a41368f51986d6b96339d824b27e5f7af8f7cd33 Mon Sep 17 00:00:00 2001 From: "Randall C. O'Reilly" Date: Mon, 29 Sep 2025 07:56:50 +0200 Subject: [PATCH 2/3] scroll: it is not the focus it seems. --- core/text.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/core/text.go b/core/text.go index 88e693803f..5a8fa78bd6 100644 --- a/core/text.go +++ b/core/text.go @@ -54,6 +54,8 @@ type Text struct { // selectRange is the selected range, in _runes_, which must be applied selectRange textpos.Range + + wasFocused bool } // TextTypes is an enum containing the different @@ -234,6 +236,23 @@ func (tx *Text) Init() { tx.Styles.Cursor = tx.normalCursor } }) + tx.OnFirst(events.Click, func(e events.Event) { + if tx.ContainsFocus() { + fmt.Println("contains focus") + tx.wasFocused = true + return + } + fmt.Println("wasn't focused") + tx.wasFocused = false + }) + tx.OnFinal(events.Click, func(e events.Event) { + if tx.wasFocused { + fmt.Println("was focused") + tx.wasFocused = false + e.SetHandled() + tx.parentWidget().SetFocusQuiet() + } + }) tx.On(events.DoubleClick, func(e events.Event) { e.SetHandled() tx.selectWord(tx.pixelToRune(e.Pos())) @@ -263,7 +282,6 @@ func (tx *Text) Init() { }) tx.On(events.SlideStop, func(e events.Event) { tx.SetState(false, states.Sliding) - tx.parentWidget().SetFocusQuiet() if TheApp.SystemPlatform().IsMobile() { tx.Send(events.ContextMenu, e) } From 2ef1eb4e9c740ee9987d170f27f69b826eff0719 Mon Sep 17 00:00:00 2001 From: "Randall C. O'Reilly" Date: Tue, 30 Sep 2025 22:48:25 +0200 Subject: [PATCH 3/3] scroll: fixed the issue: key is to toggle the Attend state on Click -- focus is not the relevant state. --- core/text.go | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/core/text.go b/core/text.go index 5a8fa78bd6..2e35a39997 100644 --- a/core/text.go +++ b/core/text.go @@ -54,8 +54,6 @@ type Text struct { // selectRange is the selected range, in _runes_, which must be applied selectRange textpos.Range - - wasFocused bool } // TextTypes is an enum containing the different @@ -236,21 +234,17 @@ func (tx *Text) Init() { tx.Styles.Cursor = tx.normalCursor } }) - tx.OnFirst(events.Click, func(e events.Event) { - if tx.ContainsFocus() { - fmt.Println("contains focus") - tx.wasFocused = true + tx.OnFinal(events.Click, func(e events.Event) { + if !TheApp.SystemPlatform().IsMobile() { return } - fmt.Println("wasn't focused") - tx.wasFocused = false - }) - tx.OnFinal(events.Click, func(e events.Event) { - if tx.wasFocused { - fmt.Println("was focused") - tx.wasFocused = false + if tx.StateIs(states.Attended) { // toggle attention with clicking + // this allows drag scrolling to proceed. e.SetHandled() - tx.parentWidget().SetFocusQuiet() + em := tx.Events() + if em != nil { + em.setAttend(nil) + } } }) tx.On(events.DoubleClick, func(e events.Event) { @@ -281,7 +275,6 @@ func (tx *Text) Init() { tx.NeedsRender() }) tx.On(events.SlideStop, func(e events.Event) { - tx.SetState(false, states.Sliding) if TheApp.SystemPlatform().IsMobile() { tx.Send(events.ContextMenu, e) }