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

Moving changed only for iOS classes to platform specific methods and structs + RenderUtils methods for converting LineJoin and LineCap moved to appropriate structs

This commit is contained in:
Anton Marunko 2018-09-27 17:30:04 +06:00
parent f1951eb288
commit 24e0449826
18 changed files with 278 additions and 68 deletions

View File

@ -11,6 +11,14 @@
3002331D20CC0BDD00EFD92D /* BoundsUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3002331B20CC0BDD00EFD92D /* BoundsUtils.swift */; };
3081E77D20DB58B100640F96 /* DescriptionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3081E77C20DB58B100640F96 /* DescriptionExtensions.swift */; };
3081E77E20DB58B100640F96 /* DescriptionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3081E77C20DB58B100640F96 /* DescriptionExtensions.swift */; };
30FF4962215CE97300FF653C /* MCAMediaTimingFillMode_iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30FF4961215CE97300FF653C /* MCAMediaTimingFillMode_iOS.swift */; };
30FF4964215CEA9900FF653C /* MCAMediaTimingFillMode_macOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30FF4963215CEA9900FF653C /* MCAMediaTimingFillMode_macOS.swift */; };
30FF4966215CEC0C00FF653C /* MCAShapeLayerLineJoin_macOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30FF4965215CEC0C00FF653C /* MCAShapeLayerLineJoin_macOS.swift */; };
30FF4969215CED8100FF653C /* MCAShapeLayerLineJoin_iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30FF4967215CECA400FF653C /* MCAShapeLayerLineJoin_iOS.swift */; };
30FF496B215CF0ED00FF653C /* MCAShapeLayerLineCap_iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30FF496A215CF0ED00FF653C /* MCAShapeLayerLineCap_iOS.swift */; };
30FF496D215CF27E00FF653C /* MCAShapeLayerLineCap_macOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30FF496C215CF27E00FF653C /* MCAShapeLayerLineCap_macOS.swift */; };
30FF496F215CF3B000FF653C /* MCAMediaTimingFunctionName_iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30FF496E215CF3B000FF653C /* MCAMediaTimingFunctionName_iOS.swift */; };
30FF4971215CF4CE00FF653C /* MCAMediaTimingFunctionName_macOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30FF4970215CF4CE00FF653C /* MCAMediaTimingFunctionName_macOS.swift */; };
5713C4E21E51EC8F00BBA4D9 /* TouchEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5713C4E11E51EC8F00BBA4D9 /* TouchEvent.swift */; };
5713C4F31E5AD46800BBA4D9 /* ControlStatesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5713C4F21E5AD46800BBA4D9 /* ControlStatesTests.swift */; };
5713C4F51E5AE2C300BBA4D9 /* CombineAnimationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5713C4F41E5AE2C300BBA4D9 /* CombineAnimationTests.swift */; };
@ -534,6 +542,15 @@
/* Begin PBXFileReference section */
3002331B20CC0BDD00EFD92D /* BoundsUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoundsUtils.swift; sourceTree = "<group>"; };
3081E77C20DB58B100640F96 /* DescriptionExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DescriptionExtensions.swift; sourceTree = "<group>"; };
30FF495F215CDD5700FF653C /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
30FF4961215CE97300FF653C /* MCAMediaTimingFillMode_iOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MCAMediaTimingFillMode_iOS.swift; sourceTree = "<group>"; };
30FF4963215CEA9900FF653C /* MCAMediaTimingFillMode_macOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MCAMediaTimingFillMode_macOS.swift; sourceTree = "<group>"; };
30FF4965215CEC0C00FF653C /* MCAShapeLayerLineJoin_macOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MCAShapeLayerLineJoin_macOS.swift; sourceTree = "<group>"; };
30FF4967215CECA400FF653C /* MCAShapeLayerLineJoin_iOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MCAShapeLayerLineJoin_iOS.swift; sourceTree = "<group>"; };
30FF496A215CF0ED00FF653C /* MCAShapeLayerLineCap_iOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MCAShapeLayerLineCap_iOS.swift; sourceTree = "<group>"; };
30FF496C215CF27E00FF653C /* MCAShapeLayerLineCap_macOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MCAShapeLayerLineCap_macOS.swift; sourceTree = "<group>"; };
30FF496E215CF3B000FF653C /* MCAMediaTimingFunctionName_iOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MCAMediaTimingFunctionName_iOS.swift; sourceTree = "<group>"; };
30FF4970215CF4CE00FF653C /* MCAMediaTimingFunctionName_macOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MCAMediaTimingFunctionName_macOS.swift; sourceTree = "<group>"; };
5713C4E11E51EC8F00BBA4D9 /* TouchEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TouchEvent.swift; sourceTree = "<group>"; };
5713C4F21E5AD46800BBA4D9 /* ControlStatesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlStatesTests.swift; sourceTree = "<group>"; };
5713C4F41E5AE2C300BBA4D9 /* CombineAnimationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CombineAnimationTests.swift; sourceTree = "<group>"; };
@ -927,6 +944,14 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
30FF495E215CDD5700FF653C /* Frameworks */ = {
isa = PBXGroup;
children = (
30FF495F215CDD5700FF653C /* QuartzCore.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
5713C4F11E5AD35900BBA4D9 /* Animation */ = {
isa = PBXGroup;
children = (
@ -1268,6 +1293,7 @@
57FCD26E1D76EA4600CC0FB6 /* Macaw */,
57FCD27A1D76EA4600CC0FB6 /* MacawTests */,
57FCD26D1D76EA4600CC0FB6 /* Products */,
30FF495E215CDD5700FF653C /* Frameworks */,
);
sourceTree = "<group>";
};
@ -1531,6 +1557,10 @@
A718CD4B1F45C28F00966E06 /* MDisplayLink_macOS.swift */,
A718CD4C1F45C28F00966E06 /* MView_macOS.swift */,
A718CD511F45C2A400966E06 /* MBezierPath+Extension_macOS.swift */,
30FF4963215CEA9900FF653C /* MCAMediaTimingFillMode_macOS.swift */,
30FF4965215CEC0C00FF653C /* MCAShapeLayerLineJoin_macOS.swift */,
30FF496C215CF27E00FF653C /* MCAShapeLayerLineCap_macOS.swift */,
30FF4970215CF4CE00FF653C /* MCAMediaTimingFunctionName_macOS.swift */,
);
name = macOS;
sourceTree = "<group>";
@ -1542,6 +1572,10 @@
A718CD451F45C28700966E06 /* Graphics_iOS.swift */,
A718CD461F45C28700966E06 /* MView_iOS.swift */,
57F1087B1F53CA7E00DC365B /* MDisplayLink_iOS.swift */,
30FF4961215CE97300FF653C /* MCAMediaTimingFillMode_iOS.swift */,
30FF4967215CECA400FF653C /* MCAShapeLayerLineJoin_iOS.swift */,
30FF496A215CF0ED00FF653C /* MCAShapeLayerLineCap_iOS.swift */,
30FF496E215CF3B000FF653C /* MCAMediaTimingFunctionName_iOS.swift */,
);
name = iOS;
sourceTree = "<group>";
@ -1985,6 +2019,7 @@
57614B181F83D15600875933 /* SVGView.swift in Sources */,
57614B191F83D15600875933 /* Arc.swift in Sources */,
57614B1A1F83D15600875933 /* MacawView.swift in Sources */,
30FF4964215CEA9900FF653C /* MCAMediaTimingFillMode_macOS.swift in Sources */,
5B7D7ED421300D4A00B5ED00 /* TimingFunction.swift in Sources */,
5B6E193420AC58F900454E7E /* Baseline.swift in Sources */,
57614B1B1F83D15600875933 /* Image.swift in Sources */,
@ -1998,6 +2033,7 @@
5852891720B29D67003E51D1 /* TransformedLocus.swift in Sources */,
57614B221F83D15600875933 /* ImageRenderer.swift in Sources */,
57614B231F83D15600875933 /* PathFunctions.swift in Sources */,
30FF4966215CEC0C00FF653C /* MCAShapeLayerLineJoin_macOS.swift in Sources */,
57614B241F83D15600875933 /* SVGSerializer.swift in Sources */,
57614B251F83D15600875933 /* MorphingAnimation.swift in Sources */,
5B6E192420AC58F900454E7E /* OffsetEffect.swift in Sources */,
@ -2036,6 +2072,7 @@
57614B471F83D15600875933 /* TouchEvent.swift in Sources */,
57614B481F83D15600875933 /* MBezierPath+Extension_macOS.swift in Sources */,
5BFEF5CF20B80A83008DAC11 /* BlendEffect.swift in Sources */,
30FF496D215CF27E00FF653C /* MCAShapeLayerLineCap_macOS.swift in Sources */,
57614B491F83D15600875933 /* MView_macOS.swift in Sources */,
5B6E192E20AC58F900454E7E /* Font.swift in Sources */,
5BFEF5D120B80A83008DAC11 /* ColorMatrixEffect.swift in Sources */,
@ -2068,6 +2105,7 @@
57614B631F83D15600875933 /* Insets.swift in Sources */,
3081E77E20DB58B100640F96 /* DescriptionExtensions.swift in Sources */,
57614B641F83D15600875933 /* Rect.swift in Sources */,
30FF4971215CF4CE00FF653C /* MCAMediaTimingFunctionName_macOS.swift in Sources */,
57614B651F83D15600875933 /* PathBuilder.swift in Sources */,
57614B661F83D15600875933 /* PinchEvent.swift in Sources */,
57614B671F83D15600875933 /* ContentsInterpolation.swift in Sources */,
@ -2140,6 +2178,7 @@
57E5E15F1E3B393900D1CB28 /* TransformInterpolation.swift in Sources */,
57A27BD31E44C5570057BD3A /* ShapeAnimationGenerator.swift in Sources */,
57E5E1571E3B393900D1CB28 /* AnimationUtils.swift in Sources */,
30FF496F215CF3B000FF653C /* MCAMediaTimingFunctionName_iOS.swift in Sources */,
57E5E1981E3B393900D1CB28 /* Polygon.swift in Sources */,
57E5E1701E3B393900D1CB28 /* TransformAnimation.swift in Sources */,
57E5E16C1E3B393900D1CB28 /* CombineAnimation.swift in Sources */,
@ -2162,6 +2201,7 @@
57E5E1A21E3B393900D1CB28 /* Text.swift in Sources */,
57F1087C1F53CA7E00DC365B /* MDisplayLink_iOS.swift in Sources */,
57E5E1A61E3B393900D1CB28 /* RenderContext.swift in Sources */,
30FF4969215CED8100FF653C /* MCAShapeLayerLineJoin_iOS.swift in Sources */,
57E5E19C1E3B393900D1CB28 /* Size.swift in Sources */,
57E5E1991E3B393900D1CB28 /* Polyline.swift in Sources */,
5B6E193120AC58F900454E7E /* LineJoin.swift in Sources */,
@ -2211,8 +2251,10 @@
57E5E1AD1E3B393900D1CB28 /* SVGParserRegexHelper.swift in Sources */,
5B6E192920AC58F900454E7E /* Align.swift in Sources */,
57E5E1B11E3B393900D1CB28 /* NSTimer+Closure.swift in Sources */,
30FF4962215CE97300FF653C /* MCAMediaTimingFillMode_iOS.swift in Sources */,
5B6E193520AC58F900454E7E /* Stop.swift in Sources */,
572CEFC71E2CED4B008C7C83 /* SWXMLHash+TypeConversion.swift in Sources */,
30FF496B215CF0ED00FF653C /* MCAShapeLayerLineCap_iOS.swift in Sources */,
57E5E16B1E3B393900D1CB28 /* AnimationSequence.swift in Sources */,
5B1A8C7620A15F7300E5FFAE /* SVGNodeLayout.swift in Sources */,
57E5E1671E3B393900D1CB28 /* MorphingGenerator.swift in Sources */,

View File

@ -0,0 +1,21 @@
//
// MCAMediaTimingFillMode.swift
// Macaw
//
// Created by Anton Marunko on 27/09/2018.
// Copyright © 2018 Exyte. All rights reserved.
//
import Foundation
#if os(iOS)
import UIKit
public struct MCAMediaTimingFillMode {
public static let forwards = CAMediaTimingFillMode.forwards
public static let backwards = CAMediaTimingFillMode.backwards
public static let both = CAMediaTimingFillMode.both
public static let removed = CAMediaTimingFillMode.removed
}
#endif

View File

@ -0,0 +1,21 @@
//
// MCAMediaTimingFillMode_macOS.swift
// MacawOSX
//
// Created by Anton Marunko on 27/09/2018.
// Copyright © 2018 Exyte. All rights reserved.
//
import Foundation
#if os(OSX)
import AppKit
public struct MCAMediaTimingFillMode {
public static let forwards = kCAFillModeForwards
public static let backwards = kCAFillModeBackwards
public static let both = kCAFillModeBoth
public static let removed = kCAFillModeRemoved
}
#endif

View File

@ -0,0 +1,22 @@
//
// MCAMediaTimingFunctionName_iOS.swift
// Macaw
//
// Created by Anton Marunko on 27/09/2018.
// Copyright © 2018 Exyte. All rights reserved.
//
import Foundation
#if os(iOS)
import UIKit
public struct MCAMediaTimingFunctionName {
static let linear = CAMediaTimingFunctionName.linear
static let easeIn = CAMediaTimingFunctionName.easeIn
static let easeOut = CAMediaTimingFunctionName.easeOut
static let easeInEaseOut = CAMediaTimingFunctionName.easeInEaseOut
static let `default` = CAMediaTimingFunctionName.default
}
#endif

View File

@ -0,0 +1,24 @@
//
// MCAMediaTimingFunctionName_macOS.swift
// MacawOSX
//
// Created by Anton Marunko on 27/09/2018.
// Copyright © 2018 Exyte. All rights reserved.
//
import Foundation
import Foundation
#if os(OSX)
import AppKit
public struct MCAMediaTimingFunctionName {
static let linear = kCAMediaTimingFunctionDefault
static let easeIn = kCAMediaTimingFunctionEaseIn
static let easeOut = kCAMediaTimingFunctionEaseOut
static let easeInEaseOut = kCAMediaTimingFunctionEaseInEaseOut
static let `default` = kCAMediaTimingFunctionDefault
}
#endif

View File

@ -0,0 +1,31 @@
//
// MCAShapeLayerLineCap_iOS.swift
// Macaw
//
// Created by Anton Marunko on 27/09/2018.
// Copyright © 2018 Exyte. All rights reserved.
//
import Foundation
#if os(iOS)
import UIKit
public struct MCAShapeLayerLineCap {
static let butt = CAShapeLayerLineCap.butt
static let round = CAShapeLayerLineCap.round
static let square = CAShapeLayerLineCap.square
static func mapToGraphics(model: LineCap) -> CAShapeLayerLineCap {
switch model {
case .butt:
return MCAShapeLayerLineCap.butt
case .round:
return MCAShapeLayerLineCap.round
case .square:
return MCAShapeLayerLineCap.square
}
}
}
#endif

View File

@ -0,0 +1,31 @@
//
// MCAShapeLayerLineCap_macOS.swift
// MacawOSX
//
// Created by Anton Marunko on 27/09/2018.
// Copyright © 2018 Exyte. All rights reserved.
//
import Foundation
#if os(OSX)
import AppKit
public struct MCAShapeLayerLineCap {
static let butt = kCALineCapButt
static let round = kCALineCapRound
static let square = kCALineCapSquare
static func mapToGraphics(model: LineCap) -> String {
switch model {
case .butt:
return MCAShapeLayerLineCap.butt
case .round:
return MCAShapeLayerLineCap.round
case .square:
return MCAShapeLayerLineCap.square
}
}
}
#endif

View File

@ -0,0 +1,31 @@
//
// MCAShapeLayerLineJoin_iOS.swift
// MacawOSX
//
// Created by Anton Marunko on 27/09/2018.
// Copyright © 2018 Exyte. All rights reserved.
//
import Foundation
#if os(iOS)
import UIKit
public struct MCAShapeLayerLineJoin {
static let miter = CAShapeLayerLineJoin.miter
static let round = CAShapeLayerLineJoin.round
static let bevel = CAShapeLayerLineJoin.bevel
static func mapToGraphics(model: LineJoin) -> CAShapeLayerLineJoin {
switch model {
case .miter:
return MCAShapeLayerLineJoin.miter
case .round:
return MCAShapeLayerLineJoin.round
case .bevel:
return MCAShapeLayerLineJoin.bevel
}
}
}
#endif

View File

@ -0,0 +1,31 @@
//
// MCAShapeLayerLineJoin_macOS.swift
// MacawOSX
//
// Created by Anton Marunko on 27/09/2018.
// Copyright © 2018 Exyte. All rights reserved.
//
import Foundation
#if os(OSX)
import AppKit
public struct MCAShapeLayerLineJoin {
public static let miter = kCALineJoinMiter
public static let round = kCALineJoinRound
public static let bevel = kCALineJoinBevel
static func mapToGraphics(model: LineJoin) -> String {
switch model {
case .miter:
return MCAShapeLayerLineJoin.miter
case .round:
return MCAShapeLayerLineJoin.round
case .bevel:
return MCAShapeLayerLineJoin.bevel
}
}
}
#endif

View File

@ -86,8 +86,8 @@ func addMorphingAnimation(_ animation: BasicAnimation, sceneLayer: CALayer, anim
}
layer.lineWidth = CGFloat(stroke.width)
layer.lineCap = convertToCAShapeLayerLineCap(RenderUtils.mapLineCapToString(stroke.cap))
layer.lineJoin = convertToCAShapeLayerLineJoin(RenderUtils.mapLineJoinToString(stroke.join))
layer.lineCap = MCAShapeLayerLineCap.mapToGraphics(model: stroke.cap)
layer.lineJoin = MCAShapeLayerLineJoin.mapToGraphics(model: stroke.join)
layer.lineDashPattern = stroke.dashes.map { NSNumber(value: $0) }
}
@ -115,18 +115,8 @@ fileprivate func pathAnimation(from: Locus, to: Locus, duration: Double, renderT
animation.fromValue = fromPath
animation.toValue = toPath
animation.duration = duration
animation.fillMode = CAMediaTimingFillMode.forwards
animation.fillMode = MCAMediaTimingFillMode.forwards
animation.isRemovedOnCompletion = false
return animation
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertToCAShapeLayerLineCap(_ input: String) -> CAShapeLayerLineCap {
return CAShapeLayerLineCap(rawValue: input)
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertToCAShapeLayerLineJoin(_ input: String) -> CAShapeLayerLineJoin {
return CAShapeLayerLineJoin(rawValue: input)
}

View File

@ -90,7 +90,7 @@ func opacityAnimationByFunc(_ valueFunc: (Double) -> Double, duration: Double, o
}
let opacityAnimation = CAKeyframeAnimation(keyPath: "opacity")
opacityAnimation.fillMode = CAMediaTimingFillMode.forwards
opacityAnimation.fillMode = MCAMediaTimingFillMode.forwards
opacityAnimation.isRemovedOnCompletion = false
opacityAnimation.duration = duration

View File

@ -104,8 +104,8 @@ func addShapeAnimation(_ animation: BasicAnimation, sceneLayer: CALayer, animati
}
layer.lineWidth = CGFloat(stroke.width)
layer.lineCap = convertToCAShapeLayerLineCap(RenderUtils.mapLineCapToString(stroke.cap))
layer.lineJoin = convertToCAShapeLayerLineJoin(RenderUtils.mapLineJoinToString(stroke.join))
layer.lineCap = MCAShapeLayerLineCap.mapToGraphics(model: stroke.cap)
layer.lineJoin = MCAShapeLayerLineJoin.mapToGraphics(model: stroke.join)
layer.lineDashPattern = stroke.dashes.map { NSNumber(value: $0) }
} else if shape.fill == nil {
layer.strokeColor = MColor.black.cgColor
@ -204,18 +204,8 @@ fileprivate func generateShapeAnimation(from: Shape, to: Shape, duration: Double
// Group
group.duration = duration
group.fillMode = CAMediaTimingFillMode.forwards
group.fillMode = MCAMediaTimingFillMode.forwards
group.isRemovedOnCompletion = false
return group
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertToCAShapeLayerLineCap(_ input: String) -> CAShapeLayerLineCap {
return CAShapeLayerLineCap(rawValue: input)
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertToCAShapeLayerLineJoin(_ input: String) -> CAShapeLayerLineJoin {
return CAShapeLayerLineJoin(rawValue: input)
}

View File

@ -6,19 +6,19 @@ import AppKit
func caTimingFunction(_ easing: Easing) -> CAMediaTimingFunction {
if easing === Easing.ease {
return CAMediaTimingFunction(name: CAMediaTimingFunctionName.default)
return CAMediaTimingFunction(name: MCAMediaTimingFunctionName.default)
}
if easing === Easing.linear {
return CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear)
return CAMediaTimingFunction(name: MCAMediaTimingFunctionName.linear)
}
if easing === Easing.easeIn {
return CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeIn)
return CAMediaTimingFunction(name: MCAMediaTimingFunctionName.easeIn)
}
if easing === Easing.easeOut {
return CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
return CAMediaTimingFunction(name: MCAMediaTimingFunctionName.easeOut)
}
if easing === Easing.easeInOut {
return CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
return CAMediaTimingFunction(name: MCAMediaTimingFunctionName.easeInEaseOut)
}
return CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear)
return CAMediaTimingFunction(name: MCAMediaTimingFunctionName.linear)
}

View File

@ -92,7 +92,7 @@ func transformAnimationByFunc(_ animation: TransformAnimation, node: Node, durat
pathAnimation.autoreverses = animation.autoreverses
let value = AnimationUtils.absoluteTransform(node, pos: valueFunc(0), view: view)
pathAnimation.values = [NSValue(caTransform3D: CATransform3DMakeAffineTransform(value.toCG()))]
pathAnimation.fillMode = CAMediaTimingFillMode.forwards
pathAnimation.fillMode = MCAMediaTimingFillMode.forwards
pathAnimation.isRemovedOnCompletion = false
pathAnimation.path = trajectory.toCGPath()
@ -113,7 +113,7 @@ func transformAnimationByFunc(_ animation: TransformAnimation, node: Node, durat
let transformAnimation = CAKeyframeAnimation(keyPath: "transform")
transformAnimation.duration = duration
transformAnimation.values = transformValues
transformAnimation.fillMode = CAMediaTimingFillMode.forwards
transformAnimation.fillMode = MCAMediaTimingFillMode.forwards
transformAnimation.isRemovedOnCompletion = false
return transformAnimation

View File

@ -30,6 +30,10 @@ public typealias MRotationGestureRecognizer = UIRotationGestureRecognizer
public typealias MScreen = UIScreen
public typealias MViewContentMode = UIView.ContentMode
func MDefaultRunLoopMode() -> RunLoop.Mode {
return RunLoop.Mode.default
}
extension MTapGestureRecognizer {
func mNumberOfTouches() -> Int {
return numberOfTouches

View File

@ -29,6 +29,10 @@ public typealias MPinchGestureRecognizer = NSMagnificationGestureRecognizer
public typealias MRotationGestureRecognizer = NSRotationGestureRecognizer
public typealias MScreen = NSScreen
func MDefaultRunLoopMode() -> RunLoop.Mode {
return RunLoop.Mode.defaultRunLoopMode
}
extension MGestureRecognizer {
var cancelsTouchesInView: Bool {
get {

View File

@ -8,28 +8,6 @@ import AppKit
class RenderUtils {
class func mapLineJoinToString(_ join: LineJoin?) -> String {
switch join {
case LineJoin.round?:
return convertFromCAShapeLayerLineJoin(CAShapeLayerLineJoin.round)
case LineJoin.bevel?:
return convertFromCAShapeLayerLineJoin(CAShapeLayerLineJoin.bevel)
default:
return convertFromCAShapeLayerLineJoin(CAShapeLayerLineJoin.miter)
}
}
class func mapLineCapToString(_ cap: LineCap?) -> String {
switch cap {
case LineCap.round?:
return convertFromCAShapeLayerLineCap(CAShapeLayerLineCap.round)
case LineCap.square?:
return convertFromCAShapeLayerLineCap(CAShapeLayerLineCap.square)
default:
return convertFromCAShapeLayerLineCap(CAShapeLayerLineCap.butt)
}
}
class func mapDash(_ dashes: [Double]) -> UnsafeMutablePointer<CGFloat> {
let p = UnsafeMutablePointer<CGFloat>.allocate(capacity: dashes.count * MemoryLayout<CGFloat>.size)
for (index, item) in dashes.enumerated() {
@ -596,13 +574,3 @@ class RenderUtils {
}
}
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertFromCAShapeLayerLineJoin(_ input: CAShapeLayerLineJoin) -> String {
return input.rawValue
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertFromCAShapeLayerLineCap(_ input: CAShapeLayerLineCap) -> String {
return input.rawValue
}

View File

@ -40,7 +40,7 @@ class CAAnimationDelegateImpl: NSObject, CAAnimationDelegate {
if animating != nil {
animationDuration = theAnimation.duration
startTime = Date()
RunLoop.current.add(animatingTimer, forMode: RunLoop.Mode.default)
RunLoop.current.add(animatingTimer, forMode: MDefaultRunLoopMode())
}
}