-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
impr(tape mode): show next line if test has newlines (@NadAlaba) #5868
Open
NadAlaba
wants to merge
29
commits into
monkeytypegame:master
Choose a base branch
from
NadAlaba:tapeMode-newline
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
Miodec
added
the
waiting for update
Pull requests or issues that require changes/comments before continuing
label
Sep 25, 2024
github-actions
bot
removed
the
waiting for update
Pull requests or issues that require changes/comments before continuing
label
Sep 26, 2024
# Conflicts: # frontend/src/styles/test.scss # frontend/src/ts/test/test-ui.ts
# Conflicts: # frontend/src/ts/test/test-ui.ts
github-actions
bot
added
the
waiting for review
Pull requests that require a review before continuing
label
Sep 28, 2024
This PR is stale. Please trigger a re-run of the PR check action. |
This PR is stale. Please trigger a re-run of the PR check action. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
frontend
User interface or web stuff
waiting for review
Pull requests that require a review before continuing
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.
Description
Added a
div.afterNewline
that indents next line after eachdiv.newline
element (ingetWordHTML()
andupdateActiveWordLetters()
).Added
div.beforeNewline
before eachdiv.newline
so that when first line in tape mode becomes empty because ofscrollTape()
removing overflown words, the second won't jump up while the user is not expecting a line jump (ingetWordHTML()
andupdateActiveWordLetters()
).Changed
#words
display from flex to block and made.word
,.afterNewline
and.beforeNewline
elementsdisplay: inline-block
(while keeping.newline
as blocks) in order to usetext-wrap: nowrap
, but still be able to break on demand with block elements.newline
. Also, make default.word
margin-bottom in tape mode 0.25em just like in non-tape mode, since they are now practically similar.Made default
#wordsWrapper
height: auto
butmax-heigh
is 3 lines in tape mode and non tape mode.Calculate wordsInput left position in tape mode + zen mode + RTL just like with no tape mode.
In
scrollTape()
:.afterNewline
elements..afterNewline
after active word, or else the 1st one after active, or else stop at the active word..afterNewline
, while also determining the widths of words before the active word (which will be in the new margin-left of#words
), and determine what words have overflown the wrapper and need to be hidden.noRemove
parameter) don't remove elements until after the margins are set.#words
and.afterNewline
by the width of what was hidden#words
margin-left and.afterNewline
elements' margin-left.#words
margin-left animation is done in its own queue so that when we use.stop()
before the animation we'll only be stopping the margin-left animation and not the margin-top animation which is performed inlineJump()
.In
lineJump()
:lineJump()
are now similar in tapeMode on and off (currentTestLine > 0, hideBound = currentTop - 10)..afterNewline
elements have offsetTops that cannot be relied upon to determine if they need to be hidden or not. The new functionremoveElementsBeforeWord()
does that (removes all elements before lastElementToRemove (included) and returns removed.word
s count).lastElementToHide
is now the last.word
or.newline
that is higher than thehideBound
.#words
margin-top animation is done in its own queue so that we only.stop()
margin-top animation without affecting margin-left animation.Now, Config.showAllLines can be changed without restarting test.
updateTestLine()
(a new function that determines what line to jump to) now runslineJump()
in force (even when currentTestLine === 0), which is useful to update test line when changing Config.showAllLines to offPreviously, when show all lines was on and tape mode was turned on through the commandline mid-test, lineJump() (which ran because of the automatic change of showAllLines to off) would remove some elements conflicting with tape mode removing elements too. That's why each time this scenario happens allowWordRemoval (a new global variable) would be set to false, and if it is false and lineTransition is true, scrollTape() would not do anything (remove words or set #words.marginLeft) until lineJump finishes removing elements.
Closes #3907