Patch For Improved Scrollbar Behaviour

Home Forums Development Patch For Improved Scrollbar Behaviour

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #23252
    JimShorts
    Participant

    The math for the scrollbar position is incorrect, I attached a patch that fixes it.

    THEORY:
    First you determine the number of positions possible for the scrollbar. If 10 entries are visible onscreen and you have 11 entries in your list, the position of the scrollbar can be either 0 or 1. So its range is 0 to (numentries – visible).

    Now you work out the portion of the entire range of movement for the scrollbar that is devoted to each possible value. In the case where the index is either 0 or 1, each range gets 1/2 (since there are two regions). If the scrollbar is in the top half, you get index 0. If it’s in the bottom, you get index 1.

    Anyway this patch implements the correct behaviour. I tested it with a number of scenarios, including
    no scrollbar necessary
    scrollbar has 2 positions
    scrollbar has 3 positions
    scrollbar has 4 positions
    scrollbar has 100’s of positions

    Now to do this right the scrollbar “marker” should itself be scalable. Meaning it expands vertically to indicate the size of the visible entries compared to the size of the total list. This is more cosmetic, but it does look nice when it’s done. I didn’t bother.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Login

Lost Password