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

feat: Created a minimap that is positionable in the primary workspace #1824

Merged
merged 3 commits into from
Jul 25, 2023

Conversation

cesarades
Copy link
Contributor

Description
I created a minimap that is positionable in the primary workspace. I did so by adding a sibling node to the primary workspace and then using absolute CSS positioning to place it correctly.

Tests
I updated the testing so that it includes a positioned and an unpositioned minimap use case.

@cesarades cesarades requested a review from a team as a code owner July 24, 2023 23:50
@conventional-commit-lint-gcf
Copy link

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

Copy link
Contributor

@BeksOmega BeksOmega left a comment

Choose a reason for hiding this comment

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

Looks great! So excited to see the minimap being mini :D

One more top-level comment: I think there should be some unit tests for the positioning logic, since it should be pretty easy to pass it dummy data =) Can be handled in a follow up PR though!

plugins/workspace-minimap/src/minimap.ts Outdated Show resolved Hide resolved
plugins/workspace-minimap/src/minimap.ts Outdated Show resolved Hide resolved
plugins/workspace-minimap/src/minimap.ts Outdated Show resolved Hide resolved
plugins/workspace-minimap/src/minimap.ts Show resolved Hide resolved
Comment on lines 75 to 78
const hasVerticalScrollbars = this.primaryWorkspace.scrollbar &&
this.primaryWorkspace.scrollbar.canScrollHorizontally();
const hasHorizontalScrollbars = this.primaryWorkspace.scrollbar &&
this.primaryWorkspace.scrollbar.canScrollVertically();
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these checking the correct scrollbars? I know this matches what the backpack is doing, but I am a bit confused haha.

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, they are checking the scrollbars in the primary workspace. It needs that to offset the location of the minimap in case they are present.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just confused why hasVerticalScrollbars is based on canScrollHorizontally. I'm pretty sure the vertical scrollbars affect the vertical scroll.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think Beka may have been referring to how hasVerticalScrollbars is checking canScrollHorizontally, and vice versa, vs checking the primary workspace scrollbars as opposed to the minimap scrollbars. That was (is) confusing to me at least - if intentional, a comment explaining the reasoning would be helpful!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, so this is in fact an error. I've corrected it so that vertical goes with vertical and vise versa. Also, I added another use case that was no previously checked. If the scrollbar exists and scrolling is enabled, but the scrollbar is not visible, it should adjust for that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please also file a bug to update the backpack plugin similarly!

@cesarades cesarades requested a review from BeksOmega July 25, 2023 19:03
plugins/workspace-minimap/src/minimap.ts Outdated Show resolved Hide resolved
plugins/workspace-minimap/src/minimap.ts Outdated Show resolved Hide resolved
plugins/workspace-minimap/src/positioned_minimap.ts Outdated Show resolved Hide resolved
Comment on lines 75 to 78
const hasVerticalScrollbars = this.primaryWorkspace.scrollbar &&
this.primaryWorkspace.scrollbar.canScrollHorizontally();
const hasHorizontalScrollbars = this.primaryWorkspace.scrollbar &&
this.primaryWorkspace.scrollbar.canScrollVertically();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think Beka may have been referring to how hasVerticalScrollbars is checking canScrollHorizontally, and vice versa, vs checking the primary workspace scrollbars as opposed to the minimap scrollbars. That was (is) confusing to me at least - if intentional, a comment explaining the reasoning would be helpful!

Copy link
Contributor

@BeksOmega BeksOmega left a comment

Choose a reason for hiding this comment

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

LGTM =)

@cesarades cesarades merged commit 036e32a into google:master Jul 25, 2023
9 checks passed
@cesarades cesarades deleted the implementPositionable branch July 25, 2023 22:59
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.

3 participants