diff --git a/list.go b/list.go index 8da65666..8ae2a14b 100644 --- a/list.go +++ b/list.go @@ -710,7 +710,7 @@ func (l *List) MouseHandler() func(action MouseAction, event *tcell.EventMouse, if l.changed != nil { l.changed(index, item.MainText, item.SecondaryText, item.Shortcut) } - l.adjustOffset() + //l.adjustOffset() } l.currentItem = index } diff --git a/treeview.go b/treeview.go index d4b19675..9dddef49 100644 --- a/treeview.go +++ b/treeview.go @@ -843,6 +843,37 @@ func (t *TreeView) MouseHandler() func(action MouseAction, event *tcell.EventMou switch action { case MouseLeftDown: setFocus(t) + // You should make logic more complex here. + + + // 1. after scroll end, offsetY will change to "Y" + // 2. at this time selection index not set to mouse click point, it still out of view + // 3. after click event, tree will draw again. + + + // 4. draw will call 'process', process will change offsetY back to previous + // 5. after that, offsetY is wrong, at click event + // y += t.offsetY - rectY + // still use old value . click will jump to node which doesn't user except + + + // from 624- 637 + //if t.movement != treeScroll { + // if selectedIndex-t.offsetY >= height { + // t.offsetY = selectedIndex - height + 1 + // } + // if selectedIndex < t.offsetY { + // t.offsetY = selectedIndex + // } + // if t.movement != treeHome && t.movement != treeEnd { + // // treeScroll, treeHome, and treeEnd are handled by Draw(). + // t.movement = treeNone + // t.step = 0 + // } + //} + + + consumed = true case MouseLeftClick: _, rectY, _, _ := t.GetInnerRect()