Commit d54c304b by Daniel Dahan

updated SourcePreprocessor with latest statement settings

parent 104aead0
......@@ -88,24 +88,27 @@ class CascadePreprocessor: MotionCorePreprocessor {
- Parameter views: An Array of UIViews.
*/
func process(views: [UIView]) {
for view in views {
guard let (deltaTime, direction, delayMatchedViews) = context[view]?.cascade else { continue }
for v in views {
guard let (deltaTime, direction, delayMatchedViews) = context[v]?.cascade else {
continue
}
var parentView = v
var parentView = view
if view is UITableView, let wrapperView = view.subviews.get(0) {
if v is UITableView, let wrapperView = v.subviews.get(0) {
parentView = wrapperView
}
let sortedSubviews = parentView.subviews.sorted(by: direction.comparator)
let initialDelay = context[view]!.delay
let initialDelay = context[v]!.delay
let finalDelay = TimeInterval(sortedSubviews.count) * deltaTime + initialDelay
for (i, subview) in sortedSubviews.enumerated() {
let delay = TimeInterval(i) * deltaTime + initialDelay
func applyDelay(view: UIView) {
if context.pairedView(for: view) == nil {
if nil == context.pairedView(for: view) {
context[view]?.delay = delay
} else if delayMatchedViews, let paired = context.pairedView(for: view) {
......
......@@ -35,8 +35,8 @@ class IgnoreSubviewTransitionsPreprocessor: MotionCorePreprocessor {
- Parameter toViews: An Array of UIViews.
*/
override func process(fromViews: [UIView], toViews: [UIView]) {
process(views:fromViews)
process(views:toViews)
process(views: fromViews)
process(views: toViews)
}
/**
......@@ -49,7 +49,11 @@ class IgnoreSubviewTransitionsPreprocessor: MotionCorePreprocessor {
continue
}
let parentView = v is UITableView ? v.subviews.get(0) ?? v : v
var parentView = v
if v is UITableView, let wrapperView = v.subviews.get(0) {
parentView = wrapperView
}
guard recursive else {
for subview in parentView.subviews {
......
......@@ -36,7 +36,7 @@ class SourcePreprocessor: MotionCorePreprocessor {
*/
override func process(fromViews: [UIView], toViews: [UIView]) {
for fv in fromViews {
guard let i = context[fv]?.motionIdentifier, let tv = context.destinationView(for: i) else {
guard let motionIdentifier = context[fv]?.motionIdentifier, let tv = context.destinationView(for: motionIdentifier) else {
continue
}
......@@ -61,6 +61,8 @@ fileprivate extension SourcePreprocessor {
*/
func prepare(view: UIView, for targetView: UIView) {
let targetPos = context.container.convert(targetView.layer.position, from: targetView.superview!)
let targetTransform = context.container.layer.flatTransformTo(layer: targetView.layer)
var state = context[view]!
/**
......@@ -68,13 +70,13 @@ fileprivate extension SourcePreprocessor {
converted from the global container
*/
state.coordinateSpace = .global
state.position = targetPos
state.transform = targetTransform
// Remove incompatible options.
state.position = targetPos
state.transform = nil
state.size = nil
state.cornerRadius = nil
if view.bounds.size != targetView.bounds.size {
state.size = targetView.bounds.size
}
......@@ -83,10 +85,6 @@ fileprivate extension SourcePreprocessor {
state.cornerRadius = targetView.layer.cornerRadius
}
if view.layer.transform != targetView.layer.transform {
state.transform = targetView.layer.transform
}
if view.layer.shadowColor != targetView.layer.shadowColor {
state.shadowColor = targetView.layer.shadowColor
}
......
......@@ -182,12 +182,12 @@ class TransitionPreprocessor: MotionCorePreprocessor {
guard let m = motion else {
return
}
guard let fv = m.fromView else {
guard let tv = m.toView else {
return
}
guard let tv = m.toView else {
guard let fv = m.fromView else {
return
}
......@@ -224,10 +224,10 @@ class TransitionPreprocessor: MotionCorePreprocessor {
defaultAnimation = .none
} else if isNavigationController {
defaultAnimation = isPresenting ? .push(direction:.left) : .pull(direction:.right)
defaultAnimation = isPresenting ? .push(direction: .left) : .pull(direction: .right)
} else if isTabBarController {
defaultAnimation = isPresenting ? .slide(direction:.left) : .slide(direction:.right)
defaultAnimation = isPresenting ? .slide(direction: .left) : .slide(direction: .right)
} else {
defaultAnimation = .fade
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment