Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
3f971a21
Unverified
Commit
3f971a21
authored
Jan 31, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: fixed flickering issue with MotionTransition when capturing screen components
parent
9842a65b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
17 deletions
+25
-17
Sources/iOS/MotionTransition.swift
+25
-17
No files found.
Sources/iOS/MotionTransition.swift
View file @
3f971a21
...
...
@@ -212,6 +212,8 @@ open class MotionTransitionPresentationController: UIPresentationController {
open
class
MotionTransition
:
NSObject
{
open
var
isPresenting
=
false
open
var
screenSnapshot
:
UIView
!
open
let
backgroundView
=
UIView
()
open
var
toViewController
:
UIViewController
!
...
...
@@ -335,16 +337,19 @@ open class MotionTransitionPresentedAnimator: MotionTransition {
open
override
func
animateTransition
(
using
transitionContext
:
UIViewControllerContextTransitioning
)
{
super
.
animateTransition
(
using
:
transitionContext
)
transitionView
.
isHidden
=
true
screenSnapshot
=
fromView
.
snapshot
(
afterUpdates
:
true
)
screenSnapshot
.
frame
=
containerView
.
bounds
transitionView
.
addSubview
(
screenSnapshot
)
backgroundView
.
backgroundColor
=
fromView
.
backgroundColor
backgroundView
.
frame
=
transitionView
.
bounds
transitionView
.
addSubview
(
backgroundView
)
transitionView
.
insertSubview
(
backgroundView
,
belowSubview
:
screenSnapshot
)
containerView
.
insertSubview
(
toView
,
belowSubview
:
transitionView
)
toView
.
updateConstraints
()
toView
.
setNeedsLayout
()
toView
.
layoutIfNeeded
()
toView
.
isHidden
=
false
for
tv
in
toSubviews
{
for
fv
in
fromSubviews
{
...
...
@@ -388,7 +393,7 @@ open class MotionTransitionPresentedAnimator: MotionTransition {
snapshotChildAnimations
.
append
(
cornerRadiusAnimation
)
let
snapshot
=
fv
.
snapshot
(
afterUpdates
:
true
)
transitionView
.
addSubview
(
s
napshot
)
transitionView
.
insertSubview
(
snapshot
,
belowSubview
:
screenS
napshot
)
Motion
.
delay
(
t
)
{
for
ta
in
tv
.
motionTransitionAnimations
{
...
...
@@ -425,21 +430,21 @@ open class MotionTransitionPresentedAnimator: MotionTransition {
}
Motion
.
delay
(
d
)
{
[
weak
self
]
in
defer
{
transitionContext
.
completeTransition
(
!
transitionContext
.
transitionWasCancelled
)
}
guard
let
s
=
self
else
{
return
}
defer
{
s
.
transitionContext
.
completeTransition
(
!
s
.
transitionContext
.
transitionWasCancelled
)
}
s
.
transitionView
.
removeFromSuperview
()
for
v
in
s
.
transitionView
.
subviews
{
v
.
removeFromSuperview
()
}
}
transitionView
.
isHidden
=
false
screenSnapshot
.
removeFromSuperview
()
}
}
...
...
@@ -448,7 +453,9 @@ open class MotionTransitionDismissedAnimator: MotionTransition {
open
override
func
animateTransition
(
using
transitionContext
:
UIViewControllerContextTransitioning
)
{
super
.
animateTransition
(
using
:
transitionContext
)
transitionView
.
isHidden
=
true
screenSnapshot
=
fromView
.
snapshot
(
afterUpdates
:
true
)
screenSnapshot
.
frame
=
containerView
.
bounds
containerView
.
addSubview
(
screenSnapshot
)
backgroundView
.
backgroundColor
=
fromView
.
backgroundColor
backgroundView
.
frame
=
transitionView
.
bounds
...
...
@@ -457,6 +464,7 @@ open class MotionTransitionDismissedAnimator: MotionTransition {
toView
.
updateConstraints
()
toView
.
setNeedsLayout
()
toView
.
layoutIfNeeded
()
toView
.
isHidden
=
false
for
tv
in
toSubviews
{
for
fv
in
fromSubviews
{
...
...
@@ -500,7 +508,7 @@ open class MotionTransitionDismissedAnimator: MotionTransition {
snapshotChildAnimations
.
append
(
cornerRadiusAnimation
)
let
snapshot
=
fv
.
snapshot
(
afterUpdates
:
true
)
transitionView
.
addSubview
(
s
napshot
)
transitionView
.
insertSubview
(
snapshot
,
belowSubview
:
screenS
napshot
)
Motion
.
delay
(
t
)
{
for
ta
in
tv
.
motionTransitionAnimations
{
...
...
@@ -530,8 +538,6 @@ open class MotionTransitionDismissedAnimator: MotionTransition {
}
}
fromView
.
isHidden
=
true
let
d
=
transitionDuration
(
using
:
transitionContext
)
if
nil
!=
backgroundView
.
backgroundColor
{
...
...
@@ -539,14 +545,14 @@ open class MotionTransitionDismissedAnimator: MotionTransition {
}
Motion
.
delay
(
d
)
{
[
weak
self
]
in
defer
{
transitionContext
.
completeTransition
(
!
transitionContext
.
transitionWasCancelled
)
}
guard
let
s
=
self
else
{
return
}
defer
{
s
.
transitionContext
.
completeTransition
(
!
s
.
transitionContext
.
transitionWasCancelled
)
}
for
v
in
s
.
toSubviews
{
v
.
isHidden
=
false
}
...
...
@@ -557,7 +563,9 @@ open class MotionTransitionDismissedAnimator: MotionTransition {
}
}
transitionView
.
isHidden
=
false
fromView
.
isHidden
=
true
screenSnapshot
.
removeFromSuperview
()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment