Treesaver / treesaver

JavaScript library for creating column and page-based layouts
GNU General Public License v2.0
1.06k stars 112 forks source link

BreakRecord.atEnd() does not account correctly for used figures #295

Closed andreacampi closed 11 years ago

andreacampi commented 11 years ago

I've seen this bug triggered by used figures; in my case, it manifested itself with an unnecessary empty page. But I suspect the bug may be worse that that.

The code naively loops over content blocks, without taking into consideration children of that block. It looks to me like it should instead use the same logic as Page.fillColumn, using block.getNextNonChildBlock.

andreacampi commented 11 years ago

BTW, I don't understand the call to figureUsed at breakrecord.js:142. Passing the index of the block doesn't seem correct, it's supposed to be a figureIndex.

andreacampi commented 11 years ago

I pushed to my repo what I think is needed to fix this issue. @bramstein can you take a look?

I also tried to updated the unit test, but that's quite tricky without setting up a whole document.

andreacampi commented 11 years ago

Fix merged, all tests are passing.