From b239217a0deee825596d6c45bcfe05b966c01f46 Mon Sep 17 00:00:00 2001 From: Yuri Strot Date: Fri, 24 May 2019 19:43:21 +0700 Subject: [PATCH] Clean up source code --- Source/platform/macOS/Common_macOS.swift | 4 ++-- Source/platform/macOS/Graphics_macOS.swift | 2 +- Source/platform/macOS/MView_macOS.swift | 2 +- Source/views/MacawZoom.swift | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/platform/macOS/Common_macOS.swift b/Source/platform/macOS/Common_macOS.swift index 87a8751a..3fdca8c1 100644 --- a/Source/platform/macOS/Common_macOS.swift +++ b/Source/platform/macOS/Common_macOS.swift @@ -164,12 +164,12 @@ extension CGContext { private struct CGContextScale { static var _scale: CGFloat = 0.0 } - + var scale: CGFloat { get { return CGContextScale._scale } - + set(newValue) { CGContextScale._scale = newValue } diff --git a/Source/platform/macOS/Graphics_macOS.swift b/Source/platform/macOS/Graphics_macOS.swift index 57fa0fe0..d260410d 100644 --- a/Source/platform/macOS/Graphics_macOS.swift +++ b/Source/platform/macOS/Graphics_macOS.swift @@ -68,7 +68,7 @@ func MGraphicsBeginImageContextWithOptions(_ size: CGSize, _ opaque: Bool, _ sca func MGraphicsGetImageFromCurrentImageContext() -> MImage? { guard let ctx = MGraphicsGetCurrentContext(), let theCGImage = ctx.makeImage() else { - return nil + return nil } let scale = ctx.scale let size = CGSize(width: CGFloat(ctx.width) / scale, height: CGFloat(ctx.height) / scale) diff --git a/Source/platform/macOS/MView_macOS.swift b/Source/platform/macOS/MView_macOS.swift index 141346b7..469d36b4 100644 --- a/Source/platform/macOS/MView_macOS.swift +++ b/Source/platform/macOS/MView_macOS.swift @@ -79,7 +79,7 @@ open class MView: NSView, Touchable { func layoutSubviews() { super.resizeSubviews(withOldSize: self.bounds.size) } - + // MARK: - Touch pad open override func touchesBegan(with event: NSEvent) { super.touchesBegan(with: event) diff --git a/Source/views/MacawZoom.swift b/Source/views/MacawZoom.swift index 1831593b..1a9532cd 100644 --- a/Source/views/MacawZoom.swift +++ b/Source/views/MacawZoom.swift @@ -81,7 +81,7 @@ open class MacawZoom { } private func getNewZoom() -> ZoomData { - if touches.count == 0 || (touches.count == 1 && !trackMove) { + if touches.isEmpty || (touches.count == 1 && !trackMove) { return zoomData } let s1 = touches[0].point