Ticket #3651: 3651-FixForScrollIssues.patch

File 3651-FixForScrollIssues.patch, 2.1 KB (added by dsizzle, 5 years ago)

Patch to fix scrolling issues

  • src/apps/charactermap/CharacterView.cpp

    From 488d43339cdd3c2cf399eaca026d085f9339582e Mon Sep 17 00:00:00 2001
    From: dsizzle <dcieslak@yahoo.com>
    Date: Wed, 26 Nov 2014 19:41:48 +0000
    Subject: [PATCH] 3651: Added IsBlockVisible function to prevent scrolling of
     view when a block is selected in the block list, but it's already visible.
    
    ---
     src/apps/charactermap/CharacterView.cpp | 17 +++++++++++++++--
     src/apps/charactermap/CharacterView.h   |  1 +
     2 files changed, 16 insertions(+), 2 deletions(-)
    
    diff --git a/src/apps/charactermap/CharacterView.cpp b/src/apps/charactermap/CharacterView.cpp
    index aa13eae..3f311e3 100644
    a b CharacterView::IsShowingBlock(int32 blockIndex) const  
    109109void
    110110CharacterView::ScrollToBlock(int32 blockIndex)
    111111{
    112     // don't scroll if the selected character is already in view.
     112    // don't scroll if the selected block is already in view.
    113113    // this prevents distracting jumps when crossing a block
    114114    // boundary in the character view.
    115     if (IsCharacterVisible(fCurrentCharacter))
     115    if (IsBlockVisible(blockIndex))   
    116116        return;
    117117       
    118118    if (blockIndex < 0)
    CharacterView::IsCharacterVisible(uint32 c) const  
    142142}
    143143
    144144
     145bool
     146CharacterView::IsBlockVisible(int32 block) const
     147{
     148    int32 topBlock = _BlockAt(BPoint(Bounds().left, Bounds().top));
     149    int32 bottomBlock = _BlockAt(BPoint(Bounds().right, Bounds().bottom));
     150
     151    if (block >= topBlock && block <= bottomBlock)
     152        return true;
     153       
     154    return false;
     155}
     156
     157
    145158/*static*/ void
    146159CharacterView::UnicodeToUTF8(uint32 c, char* text, size_t textSize)
    147160{
  • src/apps/charactermap/CharacterView.h

    diff --git a/src/apps/charactermap/CharacterView.h b/src/apps/charactermap/CharacterView.h
    index 8c08d50..fc5e618 100644
    a b public:  
    3333            void            ScrollToBlock(int32 blockIndex);
    3434            void            ScrollToCharacter(uint32 c);
    3535            bool            IsCharacterVisible(uint32 c) const;
     36            bool            IsBlockVisible(int32 block) const;
    3637
    3738    static  void            UnicodeToUTF8(uint32 c, char* text,
    3839                                size_t textSize);