Skip to content

Conversation

@WilcoBreedt
Copy link

No description provided.

Copy link
Owner

@eKoopmans eKoopmans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, clientRect.bottom.

@WilcoBreedt
Copy link
Author

@eKoopmans , cool man, no probs ! Just hope I could have been of some help xD

@eKoopmans
Copy link
Owner

Hi, closing as these features were combined into #153. Thanks again for the contribution, I'll add you as a contributor on the readme!

@eKoopmans eKoopmans closed this Jan 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants