Change horizontal and vertical realignment to only occur when line is out of bounds.#5182
Conversation
| top, | ||
| scrollArea.top, | ||
| scrollArea.top + scrollArea.clientHeight - fontHeight | ||
| ); |
There was a problem hiding this comment.
I did this just because if your scroll view area was not exactly a multiple of the font height then the last line may be cut off when you go to debug the last line, as it will still stay in view. So instead I said that if the top is below the top of the last lines fontHeight just realign and then you can see the whole line.
|
|
||
| .CodeMirror-scroll { | ||
| margin-right: 0px; | ||
| } |
There was a problem hiding this comment.
When I was using the codeMirror, I noticed that the clientWidth that was being returned from the getScrollInfo() was not matching what was seen in the inspector. It was off by 30px. I found that by default it had a margin-right: -30px. Although once I removed this extra negative margin, it properly represented the scroll area, the bounds of the scroll view.
There was a problem hiding this comment.
@jasonLaster @mmcote you might find this discussion interesting: codemirror/codemirror5#2984
not the same margin, but maybe the same reason.
There was a problem hiding this comment.
Thank you for bringing this to my attention :) I will make some corresponding changes when I get a chance later on in the day.
…sible method to prevent realigning on each step.
3938f33 to
9e536e7
Compare
9e536e7 to
7707688
Compare
Associated Issue: #5138
Here's the Pull Request Doc
https://devtools-html.github.io/debugger.html/CONTRIBUTING.html#pull-requests
Summary of Changes
-Check if the line is currently visible.
-Only realign the line to be centered if the line is out of bounds.
Test Plan
N/A
Here's the Debugger's Testing doc
https://docs.google.com/document/d/1oBMRxV8A2ag2t22YsQOxTdEv0mXKzIg0tggJjRkU1S0/edit#.
Feel free to improve it!
Before:
After:
Before:
After:
Also added some necessary functions to be mocked in Editor.spec.js, that are used in the isVisible function.