Added more than option for page breaks#138
Added more than option for page breaks#138WilcoBreedt wants to merge 1 commit intoeKoopmans:masterfrom
Conversation
eKoopmans
left a comment
There was a problem hiding this comment.
Hi @WilcoBreedt, thank you very much! I like the idea of specifying before/after/avoid, though I'm thinking of adopting the standard CSS as a guideline. I also like your use of margins as a more flexible solution.
There are currently 4 different pagebreak PRs, I'm looking into combining them into one. Thanks again!
| Array.prototype.forEach.call(pageBreakAvoid, function pageBreak_loop(el) { | ||
| el.style.display = 'block'; | ||
| var clientRect = el.getBoundingClientRect(); | ||
| var margin = toPx(this.opt.margin[0], this.prop.pageSize.k); |
There was a problem hiding this comment.
Since pxPageHeight uses pageSize.inner (the "inner" size), none of the other calculations should need to account for margin.
| el.style.display = 'block'; | ||
| var clientRect = el.getBoundingClientRect(); | ||
| var margin = toPx(this.opt.margin[0], this.prop.pageSize.k); | ||
| if ((((clientRect.bottom + margin) / this.prop.container.offsetHeight) * pxPageHeight) > pxPageHeight) { |
There was a problem hiding this comment.
Not sure what the offsetHeight is for here...
| Array.prototype.forEach.call(pageBreaksAfter, function pageBreak_loop(el) { | ||
| el.style.display = 'block'; | ||
| var clientRect = el.getBoundingClientRect(); | ||
| el.style.marginBottom = pxPageHeight - (clientRect.top - margin) % pxPageHeight + 'px'; |
There was a problem hiding this comment.
I think this should subtract clientRect.bottom, not top.
| el.style.display = 'block'; | ||
| var clientRect = el.getBoundingClientRect(); | ||
| el.style.height = pxPageHeight - (clientRect.top % pxPageHeight) + 'px'; | ||
| el.style.marginBottom = pxPageHeight - (clientRect.top - margin) % pxPageHeight + 'px'; |
|
@eKoopmans , cool man, no probs ! Just hope I could have been of some help xD |
|
Hi, closing as these features were combined into #153. Thanks again for the contribution, I'll add you as a contributor on the readme! |
No description provided.