mirror of
https://github.com/exyte/Macaw.git
synced 2024-09-17 16:07:44 +03:00
updated to swift 5.2
This commit is contained in:
parent
4d630c7586
commit
f47ec7f7da
@ -269,7 +269,6 @@ class AnimationProducer {
|
||||
}
|
||||
|
||||
let currentDate = Date()
|
||||
var animationsToRemove = [Animation]()
|
||||
let count = contentsAnimations.count
|
||||
for (index, animationDesc) in contentsAnimations.reversed().enumerated() {
|
||||
|
||||
|
@ -116,12 +116,12 @@ extension AnimationProducer {
|
||||
func addCombineAnimation(_ combineAnimation: Animation, _ context: AnimationContext) {
|
||||
guard let combine = combineAnimation as? CombineAnimation,
|
||||
let renderer = combine.nodeRenderer,
|
||||
let view = renderer.view else {
|
||||
let _ = renderer.view else {
|
||||
return
|
||||
}
|
||||
|
||||
var animations = combine.animations
|
||||
if let fromBounds = combine.node?.bounds, let toBounds = combine.toNodes.group().bounds {
|
||||
if let _ = combine.node?.bounds, let _ = combine.toNodes.group().bounds {
|
||||
let childAnimations = createChildAnimations(combine) as! [BasicAnimation]
|
||||
animations.append(contentsOf: childAnimations)
|
||||
}
|
||||
|
@ -190,7 +190,10 @@ open class Color: Fill {
|
||||
return rgbt( r: r, g: g, b: b, t: 0 )
|
||||
}
|
||||
|
||||
override func equals<T>(other: T) -> Bool where T: Color {
|
||||
override func equals<T>(other: T) -> Bool where T: Fill {
|
||||
guard let other = other as? Color else {
|
||||
return false
|
||||
}
|
||||
return val == other.val
|
||||
}
|
||||
}
|
||||
|
@ -8,17 +8,15 @@ open class Gradient: Fill {
|
||||
self.stops = stops
|
||||
}
|
||||
|
||||
override func equals<T>(other: T) -> Bool where T: Gradient {
|
||||
if userSpace == other.userSpace {
|
||||
|
||||
if stops.isEmpty && other.stops.isEmpty {
|
||||
return true
|
||||
}
|
||||
|
||||
return stops.elementsEqual(other.stops)
|
||||
|
||||
} else {
|
||||
override func equals<T>(other: T) -> Bool where T: Fill {
|
||||
guard let other = other as? Gradient, userSpace == other.userSpace else {
|
||||
return false
|
||||
}
|
||||
|
||||
if stops.isEmpty && other.stops.isEmpty {
|
||||
return true
|
||||
}
|
||||
|
||||
return stops.elementsEqual(other.stops)
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,10 @@ open class LinearGradient: Gradient {
|
||||
)
|
||||
}
|
||||
|
||||
override func equals<T>(other: T) -> Bool where T: LinearGradient {
|
||||
override func equals<T>(other: T) -> Bool where T: Fill {
|
||||
guard let other = other as? LinearGradient else {
|
||||
return false
|
||||
}
|
||||
return super.equals(other: other) && x1 == other.x1 && x2 == other.x2 && y1 == other.y1 && y2 == other.y2
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,15 @@ open class RadialGradient: Gradient {
|
||||
)
|
||||
}
|
||||
|
||||
override func equals<T>(other: T) -> Bool where T: RadialGradient {
|
||||
return super.equals(other: other) && cx == other.cx && cy == other.cy && fx == other.fx && fy == other.fy && r == other.r
|
||||
override func equals<T>(other: T) -> Bool where T: Fill {
|
||||
guard let other = other as? RadialGradient else {
|
||||
return false
|
||||
}
|
||||
let cxEquals = cx == other.cx
|
||||
let cyEquals = cy == other.cy
|
||||
let fxEquals = fx == other.fx
|
||||
let fyEquals = fy == other.fy
|
||||
let rEquals = r == other.r
|
||||
return super.equals(other: other) && cxEquals && cyEquals && fxEquals && fyEquals && rEquals
|
||||
}
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ open class SVGParser {
|
||||
if let units = element.allAttributes["patternContentUnits"]?.text, units == "objectBoundingBox" {
|
||||
contentUserSpace = false
|
||||
}
|
||||
|
||||
|
||||
var contentNode: Node?
|
||||
if pattern.children.isEmpty {
|
||||
if let parentPattern = parentPattern {
|
||||
@ -483,7 +483,7 @@ open class SVGParser {
|
||||
}
|
||||
contentNode = Group(contents: shapes)
|
||||
}
|
||||
|
||||
|
||||
return UserSpacePattern(content: contentNode!,
|
||||
bounds: bounds,
|
||||
userSpace: userSpace,
|
||||
@ -1599,7 +1599,7 @@ open class SVGParser {
|
||||
guard let element = stop.element else {
|
||||
return .none
|
||||
}
|
||||
|
||||
|
||||
var offset: Double = 0 // This is default value, value can be omitted
|
||||
if let parsedOffset = getDoubleValueFromPercentage(element, attribute: "offset") {
|
||||
offset = parsedOffset
|
||||
|
@ -101,12 +101,12 @@ open class MacawView: MView, MGestureRecognizerDelegate {
|
||||
#if os(OSX)
|
||||
open override var layer: CALayer? {
|
||||
didSet {
|
||||
guard self.layer != nil else {
|
||||
return
|
||||
}
|
||||
initializeView()
|
||||
guard self.layer != nil else {
|
||||
return
|
||||
}
|
||||
initializeView()
|
||||
|
||||
self.renderer = RenderUtils.createNodeRenderer(node, view: self)
|
||||
self.renderer = RenderUtils.createNodeRenderer(node, view: self)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user