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

ScrollBar scrolling when mouse move without left button pressing #2060

Closed
abcxyz-me opened this issue Jun 5, 2017 · 8 comments
Closed

ScrollBar scrolling when mouse move without left button pressing #2060

abcxyz-me opened this issue Jun 5, 2017 · 8 comments

Comments

@abcxyz-me
Copy link

  • What version of the product are you using?
    -57.0.0

  • What architecture x86 or x64?
    -x64

  • On what operating system?
    -Win10

  • Are you using WinForms, WPF or OffScreen?
    -WPF

  • What steps will reproduce the problem?
    1)Run the official project 'CefSharp.Wpf.Example'
    2)Draging the scrollbar with left button pressing
    3)move the cursor out of the browser control(move to right side)with left button pressing
    4)release left button
    5)move in browser control,the scrollbar will scrolling with mouse moving

@martinburrows
Copy link

I'm also seeing this with the latest version 62 prerelease.

The scrolling behavior is also inconsistent with the behavior of other standard windows. When the mouse button is held down on the scrollbar and the mouse is moved out of the window slightly to the right, scrolling should continue (try it with your browser on this page) - CefSharp allows slight movement to the left when scrolling but not to the right. This makes it very difficult to use unless the window is maximized.

@amaitland amaitland added this to the 63.0.0 milestone Dec 19, 2017
amaitland added a commit to amaitland/CefSharp that referenced this issue Jan 2, 2018
…ll SendMouseClickEvent when left mouse button pressed

Resolves cefsharp#2060

# Conflicts:
#	CefSharp.Wpf/ChromiumWebBrowser.cs
@martinburrows
Copy link

martinburrows commented Jan 11, 2018

Hi @amaitland - the fix in 49463b2 still does not allow the mouse to be moved even slightly to the right of the scrolllbar when scrolling, this affects usablilty. Standard windows do allow the mouse to be moved either to the left or the right of the scrollbar.

I had better results by capturing the mouse instead - this works fine with the example app in Windows 10:

    protected override void OnMouseLeave(MouseEventArgs e)
    {
            if (!e.Handled && browser != null)
            {
                var modifiers = e.GetModifiers();
            
                if (modifiers == CefEventFlags.LeftMouseButton)
                {
                    Mouse.Capture(this, CaptureMode.SubTree);
                }
                else
                {
                    browser.GetHost().SendMouseMoveEvent(-1, -1, true, modifiers);
                }
                
                ((IWebBrowserInternal)this).SetTooltipText(null);
            }
    }

@amaitland
Copy link
Member

@martinburrows Thanks for the feedback, as you can see that change has not been merged as limited testing has been done.

Comments on your code:

  • Should be sending the correct coordinates for SendMouseMoveEvent, sending -1 gives weird results.
  • For the Mouse.Capture you don't appear to be calling Mouse.Capture(null) to release the mouse, is there extra code? Or you haven't quite got that far yet?

We used Mouse.Capture in another piece of code, and it kept crashing, took ages to get the sequence just right, so I'd be reluctant to use it again, #1723 for reference. Though I will concede it is probably the only solution.

@martinburrows
Copy link

Thanks for the reply @amaitland, yes I wasn't sure of the best way for Mouse.Capture(null) to be called, if I get the time I'll look into it further.

@amaitland
Copy link
Member

For now going with my original set of changes as I think it's at least an improvement.

Merged in dd4b7d6

By all means submit a PR that Captures the mouse (and releases the capture).

amaitland added a commit that referenced this issue Jan 22, 2018
…ll SendMouseClickEvent when left mouse button pressed

Resolves #2060

# Conflicts:
#	CefSharp.Wpf/ChromiumWebBrowser.cs
@amaitland
Copy link
Member

Possibly Mouse.PreviewMouseUpOutsideCapturedElement attached event might be usable here.

https://msdn.microsoft.com/en-us/library/system.windows.input.mouse.previewmouseupoutsidecapturedelement(v=vs.110).aspx

@martinburrows
Copy link

Thanks, I'll take a look

@amaitland
Copy link
Member

Closing this now as the originally reported issue has been resolved. Improving usability makes sense, so I've opened #2258 to track that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants