[Pharo-dev] [bloc] shape size?

Igor Stasenko siguctua at gmail.com
Sun Apr 3 17:31:57 EDT 2016


On 4 April 2016 at 00:18, Thierry Goubier <thierry.goubier at gmail.com> wrote:
>
>
>>     The scroll is defined in delta in pixels. So, scrolling single line
>>     - you scroll by top or bottom line height (depending on direction).
>>
>
> You wrote a dedicated scrollbar? The standard one is [0, 1.0] with a
> constant step whatever the direction so it's hard to make the difference in
> height between the top line or the bottom line.
>

Yes. I, of course did not made it dedicated only for text. But i guess text
is only single user of it so far.


>
> But it could be worth subclassing ScrollBar for that purpose.


Unfortunately, my cognitive capacity was not that high at that moment, in
order to understand how ScrollBar is working and what needs to be done in
order to adapt it to my text model. Or maybe because when i was looking at
its implementation the only thing i was thinking is not to run screaming in
terror.
Pick one explanation, that suits you best :)


>
>
> Or maybe i lying here.. i could be 'scroll up/down' until next/previous
>> line are fully visible in layout. (There's of course an edge case, when
>> line height is bigger than viewport height)
>>
>
> That edge case is complex to handle...
>
>     Scrolling page - you scroll by using height of viewport. No need to
>>     count lines of text.
>>     And so, i scan text forward or backward until new layout fully
>>     covers part of text after such scrolling. And after it deleting
>>     portion of layout that became invisible due to scrolling.
>>     The layout has anchor point in text - a position. And then
>>     dimensions (width and height) and offset (a delta horizontal or
>>     vertical relative to perfect condition when a position in text
>>     corresponds to 0,0 point in layout )
>>
>
> Understood for the scan forward or backward.
>
>     The only place where i needed to measure text size was to
>>     positioning a scrollbar knob to represent its size & vertical
>>     position approximately close to where you in text and text size. And
>>     i really don't like that, since it requires scanning whole text..
>>     But well... tradeoffs.. It win anyways, since i succeeded to avoid
>>     most operations to be bound to text size. And only few left, that
>>     you cannot avoid.
>>
>
> What do you scan in the text? Do you compute a complete pixel height of
> the text or some approximation?
>

Well, for scrollbars it is just counting lines of text. For layout , it is
of course, fully precise text layout & kerning yadda yadda.


>
> Thanks,
>
> Thierry
>
>


-- 
Best regards,
Igor Stasenko.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20160404/10da3297/attachment.html>


More information about the Pharo-dev mailing list