Skip to content

Commit e3b2741

Browse files
author
Oil3
committed
Webm Quicklook 1.1.feb252024
Better finder preview panel Quicklook Preview and Finder now supprt`Trackpad Gesture : pinch to zoom / two fingers
1 parent 5b43dcb commit e3b2741

File tree

4 files changed

+14
-24
lines changed

4 files changed

+14
-24
lines changed

Webm Quicklook.xcodeproj/xcuserdata/zzs.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,4 @@
33
uuid = "E71DBFCB-09D0-4E83-BE4F-3320B489D463"
44
type = "1"
55
version = "2.0">
6-
<Breakpoints>
7-
<BreakpointProxy
8-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
9-
<BreakpointContent
10-
uuid = "34F59CC5-109B-4EDA-B493-292435D4C957"
11-
shouldBeEnabled = "Yes"
12-
ignoreCount = "0"
13-
continueAfterRunningActions = "No"
14-
filePath = "Webm Quicklook/ContentView.swift"
15-
startingColumnNumber = "9223372036854775807"
16-
endingColumnNumber = "9223372036854775807"
17-
startingLineNumber = "11"
18-
endingLineNumber = "11"
19-
landmarkName = "ContentView"
20-
landmarkType = "14">
21-
</BreakpointContent>
22-
</BreakpointProxy>
23-
</Breakpoints>
246
</Bucket>

Webm Quicklook/ContentView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct ContentView: View {
1515
Image(systemName: "puzzlepiece.extension")
1616
Image(systemName: "powerplug")
1717

18-
Text("Gesture zoom (trackpad) enabled, ")
18+
Text("Gesture zoom (trackpad) enabled, ")
1919
QuickLookPreview(url: sampleFileURL)
2020
.frame(width: 800, height: 300)
2121
.onDisappear {

Webm Quicklook/Info.plist

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@
5151
</dict>
5252
<key>QLNeedsToBeRunInMainThread</key>
5353
<false/>
54-
<key>QLPreviewHeight</key>
55-
<real>800</real>
56-
<key>QLPreviewWidth</key>
57-
<integer>360</integer>
5854
<key>UTExportedTypeDeclarations</key>
5955
<array>
6056
<dict>

Webm Quicklook/PreviewViewController.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ import WebKit
1212
class PreviewViewController: NSViewController, QLPreviewingController {
1313

1414
var webView = WKWebView(frame: .zero)
15+
1516

1617
func preparePreviewOfFile(at url: URL, completionHandler: @escaping (Error?) -> Void) {
17-
webView.loadFileURL(url, allowingReadAccessTo: url)
18+
// webView.pauseAllMediaPlayback() //webView.load(URLRequest(url: URL(string: "about:blank")!))
19+
//we stop first to ensure the previous video is not running in the background
20+
webView.loadFileURL(url, allowingReadAccessTo: url)
21+
1822
completionHandler(nil)
1923
}
2024

@@ -23,11 +27,19 @@ class PreviewViewController: NSViewController, QLPreviewingController {
2327
self.view.addSubview(webView)
2428
//
2529
webView.pageZoom = 0.4
30+
// webView.setValue(false, forKey: "drawbackground")
2631
webView.allowsMagnification = true
2732
// webView.configuration.mediaPlaybackRequiresUserAction = true
2833
webView.autoresizingMask = [.width, .height]
2934
webView.translatesAutoresizingMaskIntoConstraints = true
3035
}
36+
override func viewWillDisappear() {
37+
super.viewWillDisappear()
38+
39+
// Stop loading and clear the web view when the view is about to disappear
40+
webView.stopLoading()
41+
webView.load(URLRequest(url: URL(string: "about:blank")!))
42+
}
3143
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
3244
print("Navigation failure: \(error.localizedDescription)")
3345
}}

0 commit comments

Comments
 (0)