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

Touch Interaction in WebView2 - Zoom / Navigation Left / Navigation Right. #606

Closed
VijayanRamachandran opened this issue Nov 6, 2020 · 15 comments
Labels
bug Something isn't working

Comments

@VijayanRamachandran
Copy link

VijayanRamachandran commented Nov 6, 2020

Usecase:

In an sample WPF window application i hosted a single instance of WebView2 as below and passed a source url to load some sample page.
In addition to that we have disabled "IsZoomControlEnabled=false" in CoreWebView2 settings as below,
CoreWebView2.Settings.IsZoomControlEnabled = false;

Current Behavior:

As seen in the attached video ( below Zip file ) we could zoom in / out ( Touch Interaction ) even though we made the settings "IsZoomControlEnabled=false".
In addition to that we could navigate Left / Right by touch interaction and we don’t see any settings to disable navigation ( Left / Right ) in case of touch interaction available in WebView2.

WebView2TouchSupport.zip

Can you please help us by fixing the zoom issue as explained above and also by providing the all necessary settings related to touch operation ( Ex: Navigation Left / Right ) to disable the operations in case of Touch ?

Version Information

Nuget - Microsoft.Web.WebView2 => 1.0.674-prerelease
Fixed Version: Microsoft.WebView2.FixedVersionRuntime.87.0.664.8.x64

AB#29613725

@VijayanRamachandran VijayanRamachandran added the bug Something isn't working label Nov 6, 2020
@champnic
Copy link
Member

champnic commented Nov 6, 2020

The zooming is a known issue, and is because touch zooming is separate from page zooming (like ctrl+-, etc.). This is tracked in #459. I've opened an item on our backlog to track the work for disabling touch gestures for navigation. Thanks!

@tofuandeve
Copy link
Contributor

Hi @VijayanRamachandran , we are working on the touch interaction (swipe navigation) settings and want to provide some more information about the scenario. The swiping gesture navigations include:

  • swipe left/right (horizontally) to trigger navigations, and
  • pull (swipe vertically) to refresh current page (currently not enabled in our Edge browser)

and we are planning to disable both in the same setting as these are actions that are naturally grouped together. Would that work for you?

@Comawhite54
Copy link

@tofuandeve
In my case, the proposal you make is exactly what I need. Do you know when this feature will be impletemented?
Thanks for your contribution here.

@tofuandeve
Copy link
Contributor

@Comawhite54 Hi, thank you for your feedback! Enabling/disabling Pinch zoom api is currently in pre-release package and we are working on implementing swipe navigation now. Thanks :)

@KumG
Copy link

KumG commented Jul 15, 2021

I updated to the last pre-release version but it is still not implemented :
image

Do you know when this feature will be impletemented?

Thank you.

@champnic
Copy link
Member

Hey @KumG - to use an experimental API you need to use Edge Dev or Canary as the runtime (or any runtime 902+). What runtime are you currently using? To switch to Dev/Canary you can set:
Environment.SetEnvironmentVariable("WEBVIEW2_RELEASE_CHANNEL_PREFERENCE", "1");

@KumG
Copy link

KumG commented Jul 16, 2021

Thank you very much @champnic I can set it to false now.

@KumG
Copy link

KumG commented Jul 16, 2021

I tried to set IsSwipeNavigationEnabled to false, but with a touch screen, I still have the animations when I swipe left/right or pull.

I have a Web application displayed on a kiosk. I don't want it to look like a web page.

Is it possible to completely disable the touch animations ?

@champnic
Copy link
Member

It doesn't navigate, but you are still seeing the animations? We'll look into it.

@tofuandeve
Copy link
Contributor

Hi @KumG , I'm trying to repro this behavior on our public sample app with the latest pre-release nuget package 1.0.902-prerelease but couldn't get it to repro, the animation didn't show up on both cases:

  1. Toggle disable IsSwipeNavigationEnabled (After toggling disable IsSwipeNavigationEnabled, the expected behavior is: both navigation and animation still work on the next navigation, but after that there is no animation or navigation-- this is because the setting change takes effect after the next navigation, similar to other webview2 settings)
  2. Programmatically set webView.CoreWebView2.Settings.IsSwipeNavigationEnabled = false; as default (Change takes effect immediately, no animation, no navigation on swiping)

Please let us know if it still repro on your end? If it does, could you please provide a bit more information on your case?

@Comawhite54
Copy link

Comawhite54 commented Aug 2, 2021

Hi @tofuandeve ,
I confirm the same "wrong" behavior on my side (the navigation is disabled OK, but I still see the "drag" animation).
My application is running on a standard computer, windows 10, desktop mode + touchscreen monitor.
Find below my initialization (I use the latest nuget & runtime):

private async void InitializeBrowser(string mydatapath, string url = null)
        {
            var env = await CoreWebView2Environment.CreateAsync(null, mydatapath);
            await webView21.EnsureCoreWebView2Async(env);
            webView21.Source = new UriBuilder(url).Uri;
            webView21.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false;
            webView21.CoreWebView2.Settings.IsZoomControlEnabled = false;
            webView21.CoreWebView2.Settings.IsPinchZoomEnabled = false;
            webView21.CoreWebView2.Settings.IsSwipeNavigationEnabled = false;
        }

@champnic
Copy link
Member

champnic commented Aug 3, 2021

These settings are now available in the latest release SDK 1.0.902.49 (IsPinchZoomEnabled):
https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2settings.ispinchzoomenabled?view=webview2-dotnet-1.0.902.49

and prerelease SDK 1.0.902-prerelease (IsSwipeNavigationEnabled):
https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2settings.ispinchzoomenabled?view=webview2-dotnet-1.0.902-prerelease

@champnic champnic closed this as completed Aug 3, 2021
@champnic
Copy link
Member

champnic commented Aug 3, 2021

@Comawhite54 Can you try setting the Source property after you set the settings?

@Comawhite54
Copy link

@champnic

I just tried, but no difference :-(. As the topic is now closed, should I open a new one for this issue or will it still be followed? Or should I just live with that issue ?

I attach an image where I try to picture the problem, just to be sure the matter is clear.

image

@champnic
Copy link
Member

champnic commented Aug 4, 2021

Hey @Comawhite54 - I think what you are describing is a different issue. The animation in this thread is referring to an arrow in a circle that comes in from the edge to indicate the page will be navigating back or forwards. I don't think we intended to turn off the touch animation you described. I'll open it as a new issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants