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
1cfbad4a
Unverified
Commit
1cfbad4a
authored
Jan 24, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: adjusted rotation MotionTransition to snapshot the current state.
parent
1c53b32f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
13 deletions
+10
-13
Sources/iOS/Material+UIFont.swift
+8
-4
Sources/iOS/MotionTransition.swift
+2
-9
No files found.
Sources/iOS/Material+UIFont.swift
View file @
1cfbad4a
...
...
@@ -32,10 +32,14 @@ import UIKit
extension
UIFont
{
/**
:name: stringSize
*/
open
func
stringSize
(
string
:
String
,
constrainedToWidth
width
:
Double
)
->
CGSize
{
return
string
.
boundingRect
(
with
:
CGSize
(
width
:
width
,
height
:
DBL_MAX
),
Calculates a CGSize value based on a width and length of a string with a
given UIFont.
- Parameter string: A String.
- Parameter constrainedTo width: A CGFloat.
- Returns a CGSize.
*/
open
func
stringSize
(
string
:
String
,
constrainedTo
width
:
CGFloat
)
->
CGSize
{
return
string
.
boundingRect
(
with
:
CGSize
(
width
:
width
,
height
:
CGFloat
(
DBL_MAX
)),
options
:
NSStringDrawingOptions
.
usesLineFragmentOrigin
,
attributes
:
[
NSFontAttributeName
:
self
],
context
:
nil
)
.
size
...
...
Sources/iOS/MotionTransition.swift
View file @
1cfbad4a
...
...
@@ -378,13 +378,8 @@ open class MotionTransitionPresentedAnimator: MotionTransitionAnimator {
let
rotateAnimation
=
Motion
.
rotate
(
angle
:
toView
.
layer
.
value
(
forKeyPath
:
MotionAnimationKeyPath
.
rotation
.
rawValue
)
as?
CGFloat
??
0
)
rotateAnimation
.
fromValue
=
fromView
.
layer
.
value
(
forKeyPath
:
MotionAnimationKeyPath
.
rotation
.
rawValue
)
as?
CGFloat
??
0
snapshot
Child
Animations
.
append
(
rotateAnimation
)
snapshotAnimations
.
append
(
rotateAnimation
)
// let backgroundColorAnimation = Motion.background(color: toView.backgroundColor ?? .clear)
// backgroundColorAnimation.fromValue = fromView.backgroundColor?.cgColor
// snapshotAnimations.append(backgroundColorAnimation)
// snapshotChildAnimations.append(backgroundColorAnimation)
//
let
cornerRadiusAnimation
=
Motion
.
corner
(
radius
:
toView
.
cornerRadius
)
snapshotAnimations
.
append
(
cornerRadiusAnimation
)
snapshotChildAnimations
.
append
(
cornerRadiusAnimation
)
...
...
@@ -499,9 +494,7 @@ open class MotionTransitionDismissedAnimator: MotionTransitionAnimator {
let
rotateAnimation
=
Motion
.
rotate
(
angle
:
toView
.
layer
.
value
(
forKeyPath
:
MotionAnimationKeyPath
.
rotation
.
rawValue
)
as?
CGFloat
??
0
)
rotateAnimation
.
fromValue
=
fromView
.
layer
.
value
(
forKeyPath
:
MotionAnimationKeyPath
.
rotation
.
rawValue
)
as?
CGFloat
??
0
snapshotChildAnimations
.
append
(
rotateAnimation
)
snapshotChildAnimations
.
append
(
Motion
.
background
(
color
:
toView
.
backgroundColor
??
.
clear
))
snapshotAnimations
.
append
(
rotateAnimation
)
let
cornerRadiusAnimation
=
Motion
.
corner
(
radius
:
toView
.
cornerRadius
)
snapshotAnimations
.
append
(
cornerRadiusAnimation
)
...
...
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