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:
amaitland
2015-04-26 07:52:07 +10:00
committed by Alex Maitland
parent 4f6130b531
commit 31891e5de3
2 changed files with 24 additions and 0 deletions
@@ -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();
+22
View File
@@ -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);
}
}
}
}
}