1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-09-11 05:05:23 +03:00

Clean up source code

This commit is contained in:
Yuri Strot 2019-05-24 19:43:21 +07:00
parent d0e55b8549
commit b239217a0d
4 changed files with 5 additions and 5 deletions

View File

@ -164,12 +164,12 @@ extension CGContext {
private struct CGContextScale { private struct CGContextScale {
static var _scale: CGFloat = 0.0 static var _scale: CGFloat = 0.0
} }
var scale: CGFloat { var scale: CGFloat {
get { get {
return CGContextScale._scale return CGContextScale._scale
} }
set(newValue) { set(newValue) {
CGContextScale._scale = newValue CGContextScale._scale = newValue
} }

View File

@ -68,7 +68,7 @@ func MGraphicsBeginImageContextWithOptions(_ size: CGSize, _ opaque: Bool, _ sca
func MGraphicsGetImageFromCurrentImageContext() -> MImage? { func MGraphicsGetImageFromCurrentImageContext() -> MImage? {
guard let ctx = MGraphicsGetCurrentContext(), guard let ctx = MGraphicsGetCurrentContext(),
let theCGImage = ctx.makeImage() else { let theCGImage = ctx.makeImage() else {
return nil return nil
} }
let scale = ctx.scale let scale = ctx.scale
let size = CGSize(width: CGFloat(ctx.width) / scale, height: CGFloat(ctx.height) / scale) let size = CGSize(width: CGFloat(ctx.width) / scale, height: CGFloat(ctx.height) / scale)

View File

@ -79,7 +79,7 @@ open class MView: NSView, Touchable {
func layoutSubviews() { func layoutSubviews() {
super.resizeSubviews(withOldSize: self.bounds.size) super.resizeSubviews(withOldSize: self.bounds.size)
} }
// MARK: - Touch pad // MARK: - Touch pad
open override func touchesBegan(with event: NSEvent) { open override func touchesBegan(with event: NSEvent) {
super.touchesBegan(with: event) super.touchesBegan(with: event)

View File

@ -81,7 +81,7 @@ open class MacawZoom {
} }
private func getNewZoom() -> ZoomData { private func getNewZoom() -> ZoomData {
if touches.count == 0 || (touches.count == 1 && !trackMove) { if touches.isEmpty || (touches.count == 1 && !trackMove) {
return zoomData return zoomData
} }
let s1 = touches[0].point let s1 = touches[0].point