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

feat: add windows options supports DisablePinchZoom configuration(#2021) #3115

Merged
merged 5 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions v2/internal/frontend/desktop/windows/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,10 @@ func (f *Frontend) setupChromium() {
if err != nil {
log.Fatal(err)
}
err = settings.PutIsPinchZoomEnabled(!opts.DisablePinchZoom)
if err != nil {
log.Fatal(err)
}
Comment on lines 543 to +549
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation of the IsPinchZoomEnabled feature uses a negation of opts.DisablePinchZoom to set the value. This logic assumes that the DisablePinchZoom field exists and is a boolean. Ensure that the DisablePinchZoom field is properly documented, and its default value aligns with the intended functionality of IsPinchZoomEnabled. Additionally, consider handling the potential absence of opts or opts.DisablePinchZoom to avoid a nil pointer dereference.

}

err = settings.PutIsStatusBarEnabled(false)
Expand Down
2 changes: 2 additions & 0 deletions v2/pkg/options/windows/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ type Options struct {
IsZoomControlEnabled bool
ZoomFactor float64

DisablePinchZoom bool

// Disable all window decorations in Frameless mode, which means no "Aero Shadow" and no "Rounded Corner" will be shown.
// "Rounded Corners" are only available on Windows 11.
DisableFramelessWindowDecorations bool
Expand Down
8 changes: 8 additions & 0 deletions website/docs/reference/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func main() {
WebviewIsTransparent: false,
WindowIsTranslucent: false,
BackdropType: windows.Mica,
DisablePinchZoom: false,
DisableWindowIcon: false,
DisableFramelessWindowDecorations: false,
WebviewUserDataPath: "",
Expand Down Expand Up @@ -577,6 +578,13 @@ The value can be one of the following:
| Mica | Use [Mica](https://learn.microsoft.com/en-us/windows/apps/design/style/mica) effect |
| Tabbed | Use Tabbed. This is a backdrop that is similar to Mica. |

#### DisablePinchZoom

Setting this to `true` will disable pinch zoom gestures.

Name: DisablePinchZoom<br/>
Type: `bool`

#### DisableWindowIcon

Setting this to `true` will remove the icon in the top left corner of the title bar.
Expand Down
4 changes: 4 additions & 0 deletions website/src/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Added windows options supports `DisablePinchZoom` configuration. Added by @tuuzed in [PR](https://github.com/wailsapp/wails/pull/3115)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be a discrepancy between the feature name mentioned in the summary (IsPinchZoomEnabled) and the one in the changelog (DisablePinchZoom). Please verify that the changelog entry matches the actual implementation in the codebase and update it accordingly to ensure consistency.


## v2.7.1 - 2023-12-10

### Fixed
Expand Down