1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-09-17 16:07:44 +03:00

Merge branch 'master' into task/layer-animation-example

# Conflicts:
#	Source/animation/types/animation_generators/CombinationAnimationGenerator.swift
This commit is contained in:
Alisa Mylnikova 2020-04-10 16:46:38 +07:00
commit ea5d2c7f8e
6 changed files with 29 additions and 21 deletions

View File

@ -269,7 +269,6 @@ class AnimationProducer {
}
let currentDate = Date()
var animationsToRemove = [Animation]()
let count = contentsAnimations.count
for (index, animationDesc) in contentsAnimations.reversed().enumerated() {

View File

@ -116,16 +116,13 @@ extension AnimationProducer {
func addCombineAnimation(_ combineAnimation: Animation, _ context: AnimationContext) {
guard let combine = combineAnimation as? CombineAnimation,
let renderer = combine.nodeRenderer,
let node = combine.node,
let view = renderer.view else {
let node = combine.node else {
return
}
var animations = combine.animations
if let fromBounds = combine.node?.bounds, let toBounds = combine.toNodes.group().bounds {
let childAnimations = createChildAnimations(combine) as! [BasicAnimation]
animations.append(contentsOf: childAnimations)
}
let childAnimations = createChildAnimations(combine) as! [BasicAnimation]
animations.append(contentsOf: childAnimations)
// Reversing
if combine.autoreverses {

View File

@ -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
}
}

View File

@ -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)
}
}

View File

@ -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
}
}

View File

@ -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
}
}