func menuWillOpen(_ menu: NSMenu) {
if captureState != .idle {
- menu.cancelTracking()
+ menu.cancelTrackingWithoutAnimation()
+ if captureState == .selectingArea {
+ NotificationCenter.default.post(name: .startRecording, object: nil, userInfo: nil)
+ return
+ }
if captureState == .recording {
NotificationCenter.default.post(name: .stopRecording, object: nil, userInfo: nil)
+ return
}
}
}
if now - gifCallbackTimer > .nanoseconds(1_000_000_000 / UInt64(captureSessionConfiguration.frameRate)) {
gifCallbackTimer = now
DispatchQueue.main.async {
- if let cgImage = frame.cgImage?.resize(by: self.pixelDensity) {
+ if var cgImage = frame.cgImage {
+ if self.pixelDensity > 1 {
+ cgImage = cgImage.resize(by: self.pixelDensity) ?? cgImage
+ }
self.images.append(cgImage)
}
}