mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-06 04:00:07 +00:00
Touch scroll basics working (only tested on one device - Surface Pro)
As the code is not well tested and I'd like to merge into the next release I'm disabling this by default IsManipulationEnabled = true can manually be set on the ChromiumWebBrowser instance to enable. Enabled by default in the WPF Example
This commit is contained in:
@@ -18,6 +18,8 @@ namespace CefSharp.Wpf.Example.Views
|
||||
browser.RequestHandler = new RequestHandler();
|
||||
browser.RegisterJsObject("bound", new BoundObject());
|
||||
browser.RegisterAsyncJsObject("boundAsync", new AsyncBoundObject());
|
||||
// Enable touch scrolling - once properly tested this will likely become the default
|
||||
browser.IsManipulationEnabled = true;
|
||||
|
||||
//browser.LifeSpanHandler = new LifespanHandler();
|
||||
browser.MenuHandler = new MenuHandler();
|
||||
|
||||
@@ -1282,5 +1282,27 @@ namespace CefSharp.Wpf
|
||||
{
|
||||
get { return disposeCount > 0; }
|
||||
}
|
||||
|
||||
protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
|
||||
{
|
||||
base.OnManipulationDelta(e);
|
||||
|
||||
if (!e.Handled)
|
||||
{
|
||||
var point = e.ManipulationOrigin;
|
||||
|
||||
var browser = GetBrowser();
|
||||
|
||||
if (browser != null)
|
||||
{
|
||||
browser.GetHost().SendMouseWheelEvent(
|
||||
(int)point.X,
|
||||
(int)point.Y,
|
||||
deltaX: (int)e.DeltaManipulation.Translation.X,
|
||||
deltaY: (int)e.DeltaManipulation.Translation.Y,
|
||||
modifiers: CefEventFlags.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user