Skip to content
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

Custom scrollbar with gutter indicators #4905

Merged
merged 6 commits into from
Sep 16, 2022

Conversation

mkslanc
Copy link
Contributor

@mkslanc mkslanc commented Aug 24, 2022

Issue #, if available:

Description of changes:
Adds custom scrollbar with indicators for annotations

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Aug 24, 2022

Codecov Report

Base: 85.76% // Head: 85.85% // Increases project coverage by +0.08% 🎉

Coverage data is based on head (f7b1b5c) compared to base (8727838).
Patch coverage: 94.54% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4905      +/-   ##
==========================================
+ Coverage   85.76%   85.85%   +0.08%     
==========================================
  Files         539      542       +3     
  Lines       40723    41131     +408     
  Branches     6442     6514      +72     
==========================================
+ Hits        34928    35313     +385     
- Misses       5795     5818      +23     
Flag Coverage Δ
unittests 85.85% <94.54%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/editor.js 82.46% <ø> (ø)
src/scrollbar.js 83.51% <ø> (+2.19%) ⬆️
src/virtual_renderer.js 79.83% <75.55%> (-0.22%) ⬇️
src/scrollbar_custom.js 95.15% <95.15%> (ø)
src/layer/decorators.js 97.56% <97.56%> (ø)
src/scrollbar_test.js 98.76% <98.76%> (ø)
src/virtual_renderer_test.js 98.88% <100.00%> (+0.22%) ⬆️
src/mode/css_completions.js 20.00% <0.00%> (-2.50%) ⬇️
src/layer/gutter.js 90.45% <0.00%> (+0.35%) ⬆️
src/lib/event.js 73.30% <0.00%> (+0.48%) ⬆️
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mkslanc mkslanc marked this pull request as ready for review August 26, 2022 11:16
y2 = Math.round(yCenter + this.halfMinDecorationHeight);
}

switch (annotations[i].type) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we instead simplify this to

ctx.fillStyle = colors[annotations[i].type] || null

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's definitely better, corrected!

var annotations = this.renderer.session.$annotations;
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
if (annotations) {
annotations.forEach(function (item) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we do something like

can we instead simplify this to

item.typeNumber = typeNumbers[item.type] || null

var ctx = this.canvas.getContext("2d");

function compare(a, b) {
if (a.typeNumber < b.typeNumber) return -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd better rename it typeNumber -> priority


};

this.compensateFoldRows = function (currentRow, foldData) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like this logic is not covered with tests, can we add tests for this?


for (let i = 0; i < annotations.length; i++) {
let currentRow = annotations[i].row;
let compensateFold = this.compensateFoldRows(currentRow, foldData);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rename currentRow to just row to avoid confusion with current cursor position


};

this.compensateFoldRows = function (currentRow, foldData) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rename currentRow to just row to avoid confusion with current cursor position

@andrewnester andrewnester merged commit 4ad83b4 into ajaxorg:master Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants