shithub: mycel

Download patch

ref: 1c6acfa38b9e601daaebbc25c1ae4997f7d22b39
parent: 68691c82402b473215a17850f4007bde4a02f12f
author: Philip Silva <philip.silva@protonmail.com>
date: Wed Jun 9 13:07:36 EDT 2021

scroll: still pass non-click mouse events

--- a/browser/scroll.go
+++ b/browser/scroll.go
@@ -245,7 +245,15 @@
 }
 
 func (ui *Scroll) Mouse(dui *duit.DUI, self *duit.Kid, m draw.Mouse, origM draw.Mouse, orig image.Point) (r duit.Result) {
-	if m.Buttons == 0 { return }
+	nOrigM := origM
+	nOrigM.Point = nOrigM.Point.Add(image.Pt(-ui.scrollbarSize, ui.Offset))
+	nm := m
+	nm.Point = nm.Point.Add(image.Pt(-ui.scrollbarSize, ui.Offset))
+
+	if m.Buttons == 0 {
+		ui.Kid.UI.Mouse(dui, &ui.Kid, nm, nOrigM, image.ZP)
+		return
+	}
 	if m.Point.In(ui.barR) {
 		r.Hit = ui
 		r.Consumed = ui.scrollMouse(m, false)
@@ -257,10 +265,6 @@
 			self.Draw = duit.Dirty
 			return
 		}
-		nOrigM := origM
-		nOrigM.Point = nOrigM.Point.Add(image.Pt(-ui.scrollbarSize, ui.Offset))
-		nm := m
-		nm.Point = nm.Point.Add(image.Pt(-ui.scrollbarSize, ui.Offset))
 		r = ui.Kid.UI.Mouse(dui, &ui.Kid, nm, nOrigM, image.ZP)
 		if r.Consumed {
 			self.Draw = duit.Dirty