Skip to content

Commit

Permalink
Merge pull request #791 from kiwix/785-on-macos-the-video-is-not-taki…
Browse files Browse the repository at this point in the history
…ng-up-the-full-screen

Fix macOS webView full-screen mode
  • Loading branch information
kelson42 committed Jun 7, 2024
2 parents 2f2d43e + cd0c8c8 commit 35e5160
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Views/BuildingBlocks/WebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ import Defaults
struct WebView: NSViewRepresentable {
@EnvironmentObject private var browser: BrowserViewModel

func makeNSView(context: Context) -> WKWebView {
browser.webView
func makeNSView(context: Context) -> NSView {
let nsView = NSView()
nsView.translatesAutoresizingMaskIntoConstraints = false
browser.webView.translatesAutoresizingMaskIntoConstraints = false
nsView.addSubview(browser.webView)
NSLayoutConstraint.activate([
browser.webView.leadingAnchor.constraint(equalTo: nsView.leadingAnchor),
browser.webView.trailingAnchor.constraint(equalTo: nsView.trailingAnchor),
browser.webView.topAnchor.constraint(equalTo: nsView.topAnchor),
browser.webView.bottomAnchor.constraint(equalTo: nsView.bottomAnchor)
])
return nsView
}

func updateNSView(_ webView: WKWebView, context: Context) { }
func updateNSView(_ nsView: NSView, context: Context) { }

func makeCoordinator() -> Coordinator {
Coordinator(view: self)
Expand Down

0 comments on commit 35e5160

Please sign in to comment.