diff options
| author | Akshay Nair <phenax5@gmail.com> | 2024-12-31 11:43:49 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-01-01 11:51:46 +0530 |
| commit | 5262d942c4c2c36529fbe704e7de165044e6dc99 (patch) | |
| tree | 9fb782f19e564bdc9c7ab6852238e12a6b6f85f3 /src/Chelleport/View.hs | |
| parent | 2f35bbd272d7b1414003bf437cc6ad675fe81400 (diff) | |
| download | chelleport-5262d942c4c2c36529fbe704e7de165044e6dc99.tar.gz chelleport-5262d942c4c2c36529fbe704e7de165044e6dc99.zip | |
Add timing measurement for each section of screen
Diffstat (limited to 'src/Chelleport/View.hs')
| -rw-r--r-- | src/Chelleport/View.hs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Chelleport/View.hs b/src/Chelleport/View.hs index 314aa39..369b93d 100644 --- a/src/Chelleport/View.hs +++ b/src/Chelleport/View.hs @@ -27,13 +27,16 @@ getSearchText state (ModeSearchData {searchInputText, searchFilteredWords, searc renderSearchView :: (MonadDraw m) => State -> ModeSearchData -> m () renderSearchView state searchData@(ModeSearchData {searchFilteredWords, searchHighlightedIndex}) = do renderGridLines state + mapM_ highlightWord $ zip [0 ..] searchFilteredWords + drawSearchText + where + highlightWord (index, OCRMatch {matchStartX, matchStartY, matchEndX, matchEndY}) = do + setDrawColor $ if searchHighlightedIndex == index then colorAccent else colorLightGray + fillRectVertices (matchStartX, matchStartY) (matchEndX, matchEndY) - forM_ (zip [0 ..] searchFilteredWords) $ \(index, OCRMatch {matchStartX, matchStartY, matchEndX, matchEndY}) -> do - setDrawColor $ if searchHighlightedIndex == index then colorAccent else colorLightGray - fillRectVertices (matchStartX, matchStartY) (matchEndX, matchEndY) - - (w, h) <- windowSize - void $ drawText (w `div` 2, 5 + h `div` 2) searchingTextStyle (Text.pack $ getSearchText state searchData) + drawSearchText = do + (w, h) <- windowSize + void $ drawText (w `div` 2, 5 + h `div` 2) searchingTextStyle (Text.pack $ getSearchText state searchData) renderHintsView :: (MonadDraw m) => State -> ModeHintsData -> m () renderHintsView state (ModeHintsData {stateGrid, stateKeySequence, stateIsMatched}) = do |
