[feat] Improve speed to calculate page breaks#17
Open
lpagliari wants to merge 1 commit into1971-feat-paginationfrom
Open
[feat] Improve speed to calculate page breaks#17lpagliari wants to merge 1 commit into1971-feat-paginationfrom
lpagliari wants to merge 1 commit into1971-feat-paginationfrom
Conversation
Don't clone lines on each pagination cycle; instead, use their line
sized (provided by ep_script_line_size) to calculate page breaks on the
fly. This allows us to remove a lot of code related to "cloned lines",
"helper lines", etc.
Also:
- optimize repagination: stop paginating when pagination cycle reaches a
point where the existing page break is on the same spot of the
calculated page break;
- use Set (instead of an object) to store lines changed on
`paginationLinesChanged`
- create helper methods for tests:
- waitToHaveAnyPageBreak
- waitToHaveAnySplitPageBreak
- waitToHaveAnyNonSplitPageBreak
- waitToHaveNNonSplitPageBreaks
- waitToHaveNSplitPageBreaks
- un-pend tests and fix them so they can validate pagination again:
- [x] basicPagination.js: adjusted and all tests passing
- [x] calculatingPageNumber.js: adjusted and all tests passing
- [ ] elementBlocks.js: not adjusted
- [x] enablePagination.js: adjusted and all tests passing
- [-] lineNumberHeight.js (should we remove this suite? We don't allow
users to show line numbers anymore...)
- [ ] otherMoreContd.js: not adjusted
- [ ] repaginate.js: adjusted, but with tests failing
- [ ] scroll.js: not adjusted
- [ ] splitElements.js: adjusted, but with tests failing
- optimize tests: don't create a new pad for each test, use the same one
and clean pad content before starting each test. This can be even more
efficient if we use UNDO instead of cleaning the pad, but to do that we
need to change the tests in a lot of places, so this is not done on this
commit;
- mark failing tests with `// FIXME`;
Implement part of https://trello.com/c/dJp83kE0/1971.
joassouza
approved these changes
Sep 10, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Don't clone lines on each pagination cycle; instead, use their line sized (provided by https://github.com/storytouch/ep_script_line_size/pull/1) to calculate page breaks on the fly. This allows us to remove a lot of code related to "cloned lines", "helper lines", etc.
Also:
Set(instead of an object) to store lines changed onpaginationLinesChangedwaitToHaveAnyPageBreakwaitToHaveAnySplitPageBreakwaitToHaveAnyNonSplitPageBreakwaitToHaveNNonSplitPageBreakswaitToHaveNSplitPageBreaksbasicPagination.js: adjusted and all tests passingcalculatingPageNumber.js: adjusted and all tests passingelementBlocks.js: not adjustedenablePagination.js: adjusted and all tests passinglineNumberHeight.js(should we remove this suite? We don't allow users to show line numbers anymore...): not adjustedotherMoreContd.js: not adjustedrepaginate.js: adjusted, but with tests failingscroll.js: not adjustedsplitElements.js: adjusted, but with tests failing// FIXME;Implement part of https://trello.com/c/dJp83kE0/1971.
Full list of PRs of this feature: