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
489a97dd
Commit
489a97dd
authored
Feb 27, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
layoutShadowPath added to better performance of animations with depth
parent
f1faab07
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
0 deletions
+25
-0
Sources/MaterialButton.swift
+3
-0
Sources/MaterialCollectionViewCell.swift
+3
-0
Sources/MaterialLayer.swift
+8
-0
Sources/MaterialTableViewCell.swift
+2
-0
Sources/MaterialView.swift
+3
-0
Sources/TextField.swift
+3
-0
Sources/TextView.swift
+3
-0
No files found.
Sources/MaterialButton.swift
View file @
489a97dd
...
@@ -180,6 +180,7 @@ public class MaterialButton : UIButton {
...
@@ -180,6 +180,7 @@ public class MaterialButton : UIButton {
shadowOffset
=
value
.
offset
shadowOffset
=
value
.
offset
shadowOpacity
=
value
.
opacity
shadowOpacity
=
value
.
opacity
shadowRadius
=
value
.
radius
shadowRadius
=
value
.
radius
layoutShadowPath
()
}
}
}
}
...
@@ -203,6 +204,7 @@ public class MaterialButton : UIButton {
...
@@ -203,6 +204,7 @@ public class MaterialButton : UIButton {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
cornerRadius
=
value
layer
.
cornerRadius
=
value
layoutShadowPath
()
if
.
Circle
==
shape
{
if
.
Circle
==
shape
{
shape
=
.
None
shape
=
.
None
}
}
...
@@ -222,6 +224,7 @@ public class MaterialButton : UIButton {
...
@@ -222,6 +224,7 @@ public class MaterialButton : UIButton {
}
else
{
}
else
{
frame
.
size
.
height
=
width
frame
.
size
.
height
=
width
}
}
layoutShadowPath
()
}
}
}
}
}
}
...
...
Sources/MaterialCollectionViewCell.swift
View file @
489a97dd
...
@@ -217,6 +217,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -217,6 +217,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
shadowOffset
=
value
.
offset
shadowOffset
=
value
.
offset
shadowOpacity
=
value
.
opacity
shadowOpacity
=
value
.
opacity
shadowRadius
=
value
.
radius
shadowRadius
=
value
.
radius
layoutShadowPath
()
}
}
}
}
...
@@ -240,6 +241,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -240,6 +241,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
cornerRadius
=
value
layer
.
cornerRadius
=
value
layoutShadowPath
()
if
.
Circle
==
shape
{
if
.
Circle
==
shape
{
shape
=
.
None
shape
=
.
None
}
}
...
@@ -259,6 +261,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -259,6 +261,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
else
{
}
else
{
frame
.
size
.
height
=
width
frame
.
size
.
height
=
width
}
}
layoutShadowPath
()
}
}
}
}
}
}
...
...
Sources/MaterialLayer.swift
View file @
489a97dd
...
@@ -165,6 +165,7 @@ public class MaterialLayer : CAShapeLayer {
...
@@ -165,6 +165,7 @@ public class MaterialLayer : CAShapeLayer {
shadowOffset
=
value
.
offset
shadowOffset
=
value
.
offset
shadowOpacity
=
value
.
opacity
shadowOpacity
=
value
.
opacity
shadowRadius
=
value
.
radius
shadowRadius
=
value
.
radius
layoutShadowPath
()
}
}
}
}
...
@@ -188,6 +189,7 @@ public class MaterialLayer : CAShapeLayer {
...
@@ -188,6 +189,7 @@ public class MaterialLayer : CAShapeLayer {
*/
*/
public
override
var
cornerRadius
:
CGFloat
{
public
override
var
cornerRadius
:
CGFloat
{
didSet
{
didSet
{
layoutShadowPath
()
if
.
Circle
==
shape
{
if
.
Circle
==
shape
{
shape
=
.
None
shape
=
.
None
}
}
...
@@ -207,6 +209,7 @@ public class MaterialLayer : CAShapeLayer {
...
@@ -207,6 +209,7 @@ public class MaterialLayer : CAShapeLayer {
}
else
{
}
else
{
frame
.
size
.
height
=
width
frame
.
size
.
height
=
width
}
}
layoutShadowPath
()
}
}
}
}
}
}
...
@@ -325,4 +328,9 @@ public class MaterialLayer : CAShapeLayer {
...
@@ -325,4 +328,9 @@ public class MaterialLayer : CAShapeLayer {
cornerRadius
=
width
/
2
cornerRadius
=
width
/
2
}
}
}
}
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
shadowPath
=
.
None
==
depth
?
nil
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CGPath
}
}
}
Sources/MaterialTableViewCell.swift
View file @
489a97dd
...
@@ -173,6 +173,7 @@ public class MaterialTableViewCell: UITableViewCell {
...
@@ -173,6 +173,7 @@ public class MaterialTableViewCell: UITableViewCell {
shadowOffset
=
value
.
offset
shadowOffset
=
value
.
offset
shadowOpacity
=
value
.
opacity
shadowOpacity
=
value
.
opacity
shadowRadius
=
value
.
radius
shadowRadius
=
value
.
radius
layoutShadowPath
()
}
}
}
}
...
@@ -196,6 +197,7 @@ public class MaterialTableViewCell: UITableViewCell {
...
@@ -196,6 +197,7 @@ public class MaterialTableViewCell: UITableViewCell {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
cornerRadius
=
value
layer
.
cornerRadius
=
value
layoutShadowPath
()
}
}
}
}
...
...
Sources/MaterialView.swift
View file @
489a97dd
...
@@ -223,6 +223,7 @@ public class MaterialView : UIView {
...
@@ -223,6 +223,7 @@ public class MaterialView : UIView {
shadowOffset
=
value
.
offset
shadowOffset
=
value
.
offset
shadowOpacity
=
value
.
opacity
shadowOpacity
=
value
.
opacity
shadowRadius
=
value
.
radius
shadowRadius
=
value
.
radius
layoutShadowPath
()
}
}
}
}
...
@@ -246,6 +247,7 @@ public class MaterialView : UIView {
...
@@ -246,6 +247,7 @@ public class MaterialView : UIView {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
cornerRadius
=
value
layer
.
cornerRadius
=
value
layoutShadowPath
()
if
.
Circle
==
shape
{
if
.
Circle
==
shape
{
shape
=
.
None
shape
=
.
None
}
}
...
@@ -265,6 +267,7 @@ public class MaterialView : UIView {
...
@@ -265,6 +267,7 @@ public class MaterialView : UIView {
}
else
{
}
else
{
frame
.
size
.
height
=
width
frame
.
size
.
height
=
width
}
}
layoutShadowPath
()
}
}
}
}
}
}
...
...
Sources/TextField.swift
View file @
489a97dd
...
@@ -159,6 +159,7 @@ public class TextField : UITextField {
...
@@ -159,6 +159,7 @@ public class TextField : UITextField {
shadowOffset
=
value
.
offset
shadowOffset
=
value
.
offset
shadowOpacity
=
value
.
opacity
shadowOpacity
=
value
.
opacity
shadowRadius
=
value
.
radius
shadowRadius
=
value
.
radius
layoutShadowPath
()
}
}
}
}
...
@@ -182,6 +183,7 @@ public class TextField : UITextField {
...
@@ -182,6 +183,7 @@ public class TextField : UITextField {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
cornerRadius
=
value
layer
.
cornerRadius
=
value
layoutShadowPath
()
if
.
Circle
==
shape
{
if
.
Circle
==
shape
{
shape
=
.
None
shape
=
.
None
}
}
...
@@ -201,6 +203,7 @@ public class TextField : UITextField {
...
@@ -201,6 +203,7 @@ public class TextField : UITextField {
}
else
{
}
else
{
frame
.
size
.
height
=
width
frame
.
size
.
height
=
width
}
}
layoutShadowPath
()
}
}
}
}
}
}
...
...
Sources/TextView.swift
View file @
489a97dd
...
@@ -161,6 +161,7 @@ public class TextView: UITextView {
...
@@ -161,6 +161,7 @@ public class TextView: UITextView {
shadowOffset
=
value
.
offset
shadowOffset
=
value
.
offset
shadowOpacity
=
value
.
opacity
shadowOpacity
=
value
.
opacity
shadowRadius
=
value
.
radius
shadowRadius
=
value
.
radius
layoutShadowPath
()
}
}
}
}
...
@@ -184,6 +185,7 @@ public class TextView: UITextView {
...
@@ -184,6 +185,7 @@ public class TextView: UITextView {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
cornerRadius
=
value
layer
.
cornerRadius
=
value
layoutShadowPath
()
if
.
Circle
==
shape
{
if
.
Circle
==
shape
{
shape
=
.
None
shape
=
.
None
}
}
...
@@ -203,6 +205,7 @@ public class TextView: UITextView {
...
@@ -203,6 +205,7 @@ public class TextView: UITextView {
}
else
{
}
else
{
frame
.
size
.
height
=
width
frame
.
size
.
height
=
width
}
}
layoutShadowPath
()
}
}
}
}
}
}
...
...
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