mirror of
https://github.com/mpv-player/mpv
synced 2025-01-26 01:23:17 +00:00
cocoa-cb: add pinch to resize window gesture
the event returns a delta ratio so we can just add it to the current window-scale. Adds support for #3214
This commit is contained in:
parent
2aa4186a25
commit
1dea80d3fd
@ -179,6 +179,11 @@ class EventsView: NSView {
|
||||
}
|
||||
}
|
||||
|
||||
override func magnify(with event: NSEvent) {
|
||||
cocoaCB.layer?.inLiveResize = event.phase == .ended ? false : true
|
||||
cocoaCB.window?.addWindowScale(Double(event.magnification))
|
||||
}
|
||||
|
||||
func signalMouseDown(_ event: NSEvent) {
|
||||
signalMouseEvent(event, MP_KEY_STATE_DOWN)
|
||||
if event.clickCount > 1 {
|
||||
|
@ -461,6 +461,12 @@ class Window: NSWindow, NSWindowDelegate {
|
||||
mpv?.command("set window-scale \(scale)")
|
||||
}
|
||||
|
||||
func addWindowScale(_ scale: Double) {
|
||||
if !isInFullscreen {
|
||||
mpv?.command("add window-scale \(scale)")
|
||||
}
|
||||
}
|
||||
|
||||
func windowDidChangeScreen(_ notification: Notification) {
|
||||
if screen == nil {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user