On Mon, Nov 08, 2004 at 03:38:22PM +0100, Alfredo Braunstein wrote: > - scrollbar (needs an approximated heuristic, because we don't know the full > y size of the document) - see Andre's post
Maybe I should clarify a bit what I wrote there. Our 'new' problem is that in the new scheme we don't have sizes (height, width) of all paragraphs anymore. Even after a full day of ediing near the end of your doc, the middle might have never went through breakParagraph(). That's good as we do not have to keep certain values up-to-date (which brings most of the O(n) -> O(1) reduction Alfredo mentioned). However, there are a few situation where we "need" this information. One such situation is "User moves scrollbar to the middle of the document". Without having height information of all outermost paragraphs it is hard to tell which paragraph exactly should actually be displayed. Now, my point is that we do not need to know this paragraph exactly. Rather it should be suffient to have (a) any paragraph near the midlle of the document and (b) 'monotone scrolling behaviour' (i.e. if you move the scrollbar down, you see paragraphs further down) and (c) if the scrollbar is at the top, you'l see the first par and at the bottom you see the last one. A possible solution to this is to show the paragraph with the index pit = int(paragraphs.size() * sliderpos) (a value between 0 and 1). Now, this allows only scrolling be full paragraphs, which obviously is not desirable, even if scrolling short and tall paragraphs with the same speed might. So wee need some kind of correction offset to start with partial paragraphs. That was the second term yoffset = paragraphs[pit].height() * (paragraphs.size() * sliderpos - pit) Andre'