~ireas/public-inbox

1

Re: [PATCH genpdf-rs v2 0/2] Forgot to run cargo fmt

Details
Message ID
<CAP_ocU-as+iWb1Sw8HkqCgbec3NpfyszJ2ud491GwEYn9V5Rrw@mail.gmail.com>
DKIM signature
pass
Download raw message
Hi Robin,
I did not see, that a new page is added, when the Layout is too long
(because I did not scroll down...)

What I actually expected to happen, was that the overflow is hidden by
default. I think it would make sense to support these two cases:

1. Overflow: Hide -> Never shows elements that are out of the bounds
of the available area.
2. Overflow: Wrap -> In the case of the vertical layout this adds a
new page, in the case of the horizontal layout this adds a new line or
a new page, depending on available space.

It would be great, if you could delete my earlier empty email, because
I sent it by accident...
Thanks in advance
Ferdinand

Re: [PATCH genpdf-rs v2 0/2] Forgot to run cargo fmt

Details
Message ID
<20210615084334.GA1168@ireas.org>
In-Reply-To
<CAP_ocU-as+iWb1Sw8HkqCgbec3NpfyszJ2ud491GwEYn9V5Rrw@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
Hi Ferdinand,

On 2021-06-15 09:37:40, Franken Apps wrote:
> What I actually expected to happen, was that the overflow is hidden by
> default. I think it would make sense to support these two cases:
> 
> 1. Overflow: Hide -> Never shows elements that are out of the bounds
> of the available area.
> 2. Overflow: Wrap -> In the case of the vertical layout this adds a
> new page, in the case of the horizontal layout this adds a new line or
> a new page, depending on available space.

Makes sense!  Maybe we could even have two different settings for that –
WrapLine and WrapPage?  And I think a term like Truncate would be more
explicit than Hide (which could also mean hiding the entire element).

Another relevant case is if one of the elements does not fit vertically:

    let mut horizontal_layout = elements::LinearLayout::horizontal();
    for i in 0..20 {
        let mut vertical_layout = elements::LinearLayout::vertical();
        for j in 0..100 {
            vertical_layout.push(elements::Paragraph::new(format!("{}.{}", i, j)).padded(1));
        }
        horizontal_layout.push(vertical_layout);
    }
    doc.push(horizontal_layout);

Currently, the layout will finish rendering element #1 and then start
rendering element #2 on the last page of element #1.  It would make more
sense to continue rendering elements on the current page until the
horizontal space is used up and then continue rendering on the next
page.  But that again raises two questions:
- What if the width of the elements changes between the pages?
- What if we have both a vertical and a horizontal overflow?

Maybe it would be the easiest to just truncate the elements vertically
so that they fit in the current page (similar to what we do in the
vertical case).  If users want more complex layouts, they should use a
TableLayout instead.  Do you agree?

> It would be great, if you could delete my earlier empty email, because
> I sent it by accident...

Sure, done!

Best,
Robin
Reply to thread Export thread (mbox)