Skip to content

Commit 013786c

Browse files
authored
Add IsPinchZoomEnabled spec
1 parent 2f527d4 commit 013786c

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

specs/IsPinchZoomEnabled.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Background
2+
3+
There are two types of zoom in Chromium: Browser Zoom and Pinch-Zoom:
4+
- Browser zoom is what you get by using Ctrl + +(plus) or – (minus) or Ctrl + Mousewheel.
5+
- Pinch-zoom is activated by using a pinch gesture on a touchscreen.
6+
7+
Currently, the first type of zoom control is supported in WebView2 and modifying it has no effect on pinch zoom.
8+
9+
In response to customer requests to be able to change the current functionality of pinch zoon in WebView2: Disable/Enanle pinch zoom, the WebView2 team has introduced Pinch Zoom API which allows users to change setting to disable/enable pinch zoom.
10+
11+
In this document we describe the new setting. We'd appreciate your feedback.
12+
13+
14+
# Description
15+
The default value for IsPinchZoomEnabled is true.
16+
When this setting is set to false, it disables pinch zoom in WebView.
17+
18+
19+
# Examples
20+
```cpp
21+
void SettingsComponent::TogglePinchZooomEnabled()
22+
{
23+
BOOL enabled;
24+
CHECK_FAILURE(coreWebView2Settings->get_IsPinchZoomEnabled(&enabled));
25+
CHECK_FAILURE(coreWebView2Settings->put_IsPinchZoomEnabled(enabled ? FALSE : TRUE));
26+
}
27+
```
28+
29+
```c#
30+
privagte WebView2 _webView;
31+
void TogglePinchZoomEnabled()
32+
{
33+
var coreWebView2Settings = webView.CoreWebView2.Settings;
34+
coreWebView2Settings.IsPinchZoomEnabled = !coreWebView2Settings.IsPinchZoomEnabled;
35+
}
36+
```
37+
# API Notes
38+
39+
See [API Details](#api-details) section below for API reference.
40+
41+
# API Details
42+
43+
## Win32 C++
44+
```cpp
45+
[uuid(B625A89E-368F-43F5-BCBA-39AA6234CCF8), object, pointer_default(unique)]
46+
interface ICoreWebView2StagingSettings : IUnknown {
47+
/// The IsPinchZoomEnabled property is used to prevent the default
48+
/// pinch zoom control from working in webview. Defaults to TRUE.
49+
/// When disabled, user will not be able to pinch zoom.
50+
///
51+
/// \snippet SettingsComponent.cpp DisablePinchZoom
52+
[propget] HRESULT IsPinchZoomEnabled([out, retval] BOOL* enabled);
53+
/// Set the IsPinchZoomEnabled property
54+
[propput] HRESULT IsPinchZoomEnabled([in] BOOL enabled);
55+
}
56+
```
57+
58+
## .NET and WinRT
59+
60+
```c#
61+
namespace Microsoft.Web.WebView2.Core
62+
{
63+
public partial class CoreWebView2Settings
64+
{
65+
///
66+
public bool IsPinchZoomEnabled { get; set};
67+
68+
}
69+
}
70+
71+
```

0 commit comments

Comments
 (0)