Ticket #99 (closed defect: duplicate)
Win2000/XP - Baseline for variable height objects become psychotic
| Reported by: | jesset77 | Owned by: | why |
|---|---|---|---|
| Milestone: | Murder | Keywords: | |
| Cc: |
Description (last modified by jesset77) (diff)
When you try and flow bunches of things with different heights, especially if the shorter stuff precedes the taller, Shoes begins grinning and brandishing a spatula at you.
First, some background:
Everyone has done it. Paste an image into a M$ word document, and it acts like a huge letter. Fun, hunh? Then, in the Netscape 1.0 days before we had any image layout power you got the same effect there. Put an image tag in a flow of text and it acts like a great big glyph.
Well, at least the behavior was predictable. You'd avoid doing that specific thing. However, sometimes you still need to show many images of slightly varying size in a row. Ideally in a flow, it would be nice if they wrap on smaller displays.
Solving that problem in HTML was a headache. We got HTML's "valign" and CSS' "vertical-align" with values like top, bottom, middle, absbottom, absmiddle, baseline, splitlevelcondo, it was a mess.
There are many strategies for making this heavenly. Taking a fresh approach like Shoes, where we have no legacy obligations, we should pick the most ruby-like way and run with it.
In the meantime Shoes can get quite cubist when presented with this problem. Here is a test case using stacks to mix up the baseline.
Shoes.app do
(1..4).each do |i|
para "hi#{i}"
stack :width => 50*i, :height => 50*i do
background magenta
end
end
end
Open the app and make sure the window is wide enough that no wrapping is needed. The first trouble you'll see is that the early paragraphs do not share a baseline with the later paragraphs. Nor do they line up on top or bottom. It's almost like they are using "baseline" alignment, but the baseline keeps getting redefined when larger objects get presented.
Next, narrow the window until things begin to wrap. Things get pretty warped. When choosing the vertical position for the next line, it's almost a dice roll. One time, I got a stack to wrap to the next line and still render 0 pixels from the top.
You'll get a lot of stacks covering over the paras, so you won't see a lot of the para's. I wanted to use a transparent background, but I am currently hampered by ticket #98. If this does not hamper your platform, feel free to try background rgb(1.0, 0, 1.0, 0.5) and keep playing. Maybe add borders.
In case anyone thinks this is a bug in the inner stacks and not the outer flow, you could substitute images. Or, even text-only. Here is another fun testcase:
Shoes.app do para 'one'*3, :size => 8 para 'two'*3, :size => 12 para 'three'*3, :size => 16 para 'four'*3, :size => 20 para 'five'*3, :size => 24 para 'six'*3, :size => 28 para 'seven'*3, :size => 32 end
In conclusion: stack+flow=awexome. Chucking the horizontal scrollbar is very liberating. Let's fix bugs like these so The Machine⢠can continue rolling, crushing inferior layout engines under it's mighty cleats.
