Forum How do I...?

Tracking boxes: how to detect column breaks?

John
Hello,

David's excellent example about changebars made me curious and so I am experimenting with Prince's JavaScript engine now. The Box-tracking API is really great for finding out more about the layout of a document.
However, I have one specific question: how do I detect whether a column break appeared between two boxes (box 1 on the left column, box 2 on the right)? I guess that's not possible, because only the coordinates change, am I right? Or is there an attribute that gives a hint about the next box (the following box) will appear in a different column?

Greetings,
John

Edited by John

mikeday
I guess you can tell from the coordinates, if the second box is to the right and higher up than the first box but on the same page then it's probably a column break. Might be handy to have that expressed more explicitly in the box tree, though.
John
Hello mike,

I thought so. I will run some tests, but I can see getting into trouble when there are absolutely positioned elements. So I will take into account if the element or its siblings are still in the "flow" or disconnected.

John
mikeday
In the latest build of Prince we've expanded the box tree to include explicit "COLUMN" boxes which should make this easier.
John
thanks, that's awesome. I will look into it.