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: Legacy style scrollbar context menu for easier navigation #495

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

soumyamahunt
Copy link
Contributor

@soumyamahunt soumyamahunt commented May 5, 2020

This PR implements notepad style scrollbar context menu but has some issues, @Jasonstein can you help with this??

PR Type

What kind of change does this PR introduce?

  • Feature

Other information

The ScrollViewer resets instantly after changing, I can't pinpoint the cause.

1HOoXiWJ93

@0x7c13
Copy link
Owner

0x7c13 commented May 5, 2020

Before you do change view, set this variable to false:
_shouldResetScrollViewerToLastKnownPositionAfterRegainingFocus = false;

Also, you can consider change selection point to 0 after user hit scroll to top button and change selection point to end of the document after user hit scroll to bottom.

@soumyamahunt
Copy link
Contributor Author

Before you do change view, set this variable to false:
_shouldResetScrollViewerToLastKnownPositionAfterRegainingFocus = false;

This doesn't work, also I am changing previous offsets before changing scroll position so it wouldn't be necessary.

Also, you can consider change selection point to 0 after user hit scroll to top button and change selection point to end of the document after user hit scroll to bottom.

Did this.

@soumyamahunt
Copy link
Contributor Author

Also there is another bug, after clicking any entry from flyout when I click on any where on the document it immitates click and hold.

qhdkvsVADt

@0x7c13
Copy link
Owner

0x7c13 commented May 6, 2020

This is why it is not going to work:

image

When the context flyout is open, editor lost its focus, then you change the view right away and editor regain focus. Then editor itself change it's view to selection point (this is done by the internal logic which cannot be modified) and then it screws up the whole thing.

Let me work on it, I think I might be able to find a workaround.

Fix scrolling issue
@0x7c13
Copy link
Owner

0x7c13 commented May 6, 2020

I think I fixed the issue but still, there are two bugs that I don't even think are solvable:

  1. Right now the vertical context flyout works great but not for the horizontal one. I don't think it is our fault, it should be a bug related to RichEdit/ScrollViewer.

  2. After changing the view, if you click on any of the text and move your mouse, it will select from there acting like you are doing mouse left click + text selection. This is super wired and I do not know why and how to fix it.

This is as far as I can go, you can take from here.

@0x7c13
Copy link
Owner

0x7c13 commented May 7, 2020

@soumyamahunt Any luck? Feel free to spin up another bug report to WinUI repo :)

@soumyamahunt
Copy link
Contributor Author

@soumyamahunt Any luck? Feel free to spin up another bug report to WinUI repo :)

Filed here.

@0x7c13
Copy link
Owner

0x7c13 commented May 13, 2020

@soumyamahunt
Copy link
Contributor Author

@soumyamahunt Give this a try? https://docs.microsoft.com/en-us/uwp/api/windows.ui.text.itextrange.scrollintoview?view=winrt-19041#Windows_UI_Text_ITextRange_ScrollIntoView_Windows_UI_Text_PointOptions_

This fixes horizontal scroll issue. However this issue not fixed:

  1. After changing the view, if you click on any of the text and move your mouse, it will select from there acting like you are doing mouse left click + text selection. This is super wired and I do not know why and how to fix it.

@0x7c13
Copy link
Owner

0x7c13 commented May 14, 2020

@soumyamahunt Give this a try? https://docs.microsoft.com/en-us/uwp/api/windows.ui.text.itextrange.scrollintoview?view=winrt-19041#Windows_UI_Text_ITextRange_ScrollIntoView_Windows_UI_Text_PointOptions_

This fixes horizontal scroll issue. However this issue not fixed:

  1. After changing the view, if you click on any of the text and move your mouse, it will select from there acting like you are doing mouse left click + text selection. This is super wired and I do not know why and how to fix it.

Did you try removing the logic of doing two manual ChangeView events on the ScrollViewer that I did?

@soumyamahunt
Copy link
Contributor Author

Did you try removing the logic of doing two manual ChangeView events on the ScrollViewer that I did?

Removing those makes the scrolling not work. Scrolling is again being reset after gaining focus.

@0x7c13
Copy link
Owner

0x7c13 commented May 14, 2020

Did you try removing the logic of doing two manual ChangeView events on the ScrollViewer that I did?

Removing those makes the scrolling not work. Scrolling is again being reset after gaining focus.

What about doing ITextRange ScrollIntoView after getting focus instead of doing it right away before ChangeView?

@soumyamahunt
Copy link
Contributor Author

What about doing ITextRange ScrollIntoView after getting focus instead of doing it right away before ChangeView?

Doesn't work this way either.

@0x7c13
Copy link
Owner

0x7c13 commented May 14, 2020

What about doing ITextRange ScrollIntoView after getting focus instead of doing it right away before ChangeView?

Doesn't work this way either.

Ok, let me give it a try.

@soumyamahunt soumyamahunt changed the title ScrollBar context menu. feat: Legacy style scrollbar context menu for easier navigation Mar 29, 2021
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.

2 participants