From 24e99ec311f7869947a06ef0745fa19d197a6c0c Mon Sep 17 00:00:00 2001 From: Francisco Vallarino Date: Tue, 2 Mar 2021 15:05:51 -0300 Subject: [PATCH] Follow focus if overlay status of the nodes matches --- src/Monomer/Widgets/Scroll.hs | 3 ++- tasks.md | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Monomer/Widgets/Scroll.hs b/src/Monomer/Widgets/Scroll.hs index f15c821b..82a36d25 100644 --- a/src/Monomer/Widgets/Scroll.hs +++ b/src/Monomer/Widgets/Scroll.hs @@ -275,8 +275,9 @@ makeScroll config state = widget where focusInst = widgetFindByPath (node ^. L.widget) wenv focusPath node focusVp = focusInst ^? _Just . L.viewport focusOverlay = focusInst ^? _Just . L.overlay == Just True + overlayMatch = focusOverlay == node ^. L.info . L.overlay result - | follow && not focusOverlay = focusVp >>= scrollTo wenv node + | follow && overlayMatch = focusVp >>= scrollTo wenv node | otherwise = Nothing ButtonAction point btn status _ -> result where leftPressed = status == PressedBtn && btn == wenv ^. L.mainButton diff --git a/tasks.md b/tasks.md index eb64e259..ce8d49c9 100644 --- a/tasks.md +++ b/tasks.md @@ -542,6 +542,7 @@ - Fix books labels - Check if using WidgetId in MoveFocus and SetFocus is possible - Auto scroll affects dropdown when listView is displayed + - Ignore overlays if scroll is not an overlay - Pending - Add header in all files, indicating license and documenting what the module does @@ -556,6 +557,7 @@ Next - Validate nested structures update correctly when disabling/enabling parent - Something of generative art (OpenGL example) - Send message to scroll to reset position when content changes + - Also scroll to focused element on init - This is for listView. Maybe a config argument is needed, since this is not always desired? Future