ref: 23b3f69bc3353332b3a39b4126a7839d716c2dbb
parent: 7bc27341ac44be2f87444d96b7e10569e8333af1
author: Philip Silva <philip.silva@protonmail.com>
date: Sun Dec 5 08:05:23 EST 2021
Fix reverse select
--- a/browser/browser.go
+++ b/browser/browser.go
@@ -732,14 +732,14 @@
r := draw.Rectangle{
draw.Point{from.X, from.Y},
draw.Point{to.X, to.Y},
- }.Canon()
- var delta image.Point
- if fromLabel != nil {
- // make sure the same coordinates are used
- // (TODO: should be consistent in the first place)
- delta = r.Min.Sub(fromLabel.Rect().Min)
}
- r = r.Sub(delta)
+ // make sure the same coordinates are used
+ // (TODO: should be consistent in the first place)
+ if rc := r.Canon(); r == rc {
+ r = r.Sub(r.Min.Sub(fromLabel.Rect().Min))
+ } else {
+ r = rc.Sub(rc.Max.Sub(fromLabel.Rect().Max))
+ }
if !rectsSimilar(dragRect, r) {
TraverseTree(el, func(ui duit.UI) {
l, ok := ui.(*duitx.Label)