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
d3ed140b
Unverified
Commit
d3ed140b
authored
Sep 10, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updated cornerRadiusPreset enum values and depthPreset enum values
parent
a675ae4f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
24 deletions
+26
-24
Sources/iOS/CornerRadius.swift
+9
-9
Sources/iOS/Depth.swift
+4
-4
Sources/iOS/Material+CALayer.swift
+13
-11
No files found.
Sources/iOS/CornerRadius.swift
View file @
d3ed140b
...
...
@@ -50,22 +50,22 @@ public func CornerRadiusPresetToValue(preset: CornerRadiusPreset) -> CGFloat {
case
.
none
:
return
0
case
.
cornerRadius1
:
return
4
return
2
case
.
cornerRadius2
:
return
8
return
4
case
.
cornerRadius3
:
return
16
return
8
case
.
cornerRadius4
:
return
24
return
12
case
.
cornerRadius5
:
return
32
return
16
case
.
cornerRadius6
:
return
4
0
return
2
0
case
.
cornerRadius7
:
return
48
return
24
case
.
cornerRadius8
:
return
56
return
28
case
.
cornerRadius9
:
return
64
return
32
}
}
Sources/iOS/Depth.swift
View file @
d3ed140b
...
...
@@ -96,14 +96,14 @@ public func DepthPresetToValue(preset: DepthPreset) -> Depth {
case
.
none
:
return
.
zero
case
.
depth1
:
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
1
),
opacity
:
0.3
,
radius
:
1
)
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
0.5
),
opacity
:
0.3
,
radius
:
0.5
)
case
.
depth2
:
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
2
),
opacity
:
0.3
,
radius
:
2
)
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
1
),
opacity
:
0.3
,
radius
:
1
)
case
.
depth3
:
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
3
),
opacity
:
0.3
,
radius
:
3
)
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
2
),
opacity
:
0.3
,
radius
:
2
)
case
.
depth4
:
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
4
),
opacity
:
0.3
,
radius
:
4
)
case
.
depth5
:
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
5
),
opacity
:
0.3
,
radius
:
5
)
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
8
),
opacity
:
0.3
,
radius
:
8
)
}
}
Sources/iOS/Material+CALayer.swift
View file @
d3ed140b
...
...
@@ -35,7 +35,7 @@ internal class MaterialLayer {
internal
weak
var
layer
:
CALayer
?
/// A property that sets the cornerRadius of the backing layer.
internal
var
cornerRadiusPreset
:
CornerRadiusPreset
=
.
none
{
internal
var
cornerRadiusPreset
=
CornerRadiusPreset
.
none
{
didSet
{
guard
let
v
=
layer
else
{
return
...
...
@@ -45,7 +45,7 @@ internal class MaterialLayer {
}
/// A preset property to set the borderWidth.
internal
var
borderWidthPreset
:
BorderWidthPreset
=
.
none
{
internal
var
borderWidthPreset
=
BorderWidthPreset
.
none
{
didSet
{
guard
let
v
=
layer
else
{
return
...
...
@@ -55,7 +55,7 @@ internal class MaterialLayer {
}
/// A preset property to set the shape.
internal
var
shapePreset
:
ShapePreset
=
.
none
internal
var
shapePreset
=
ShapePreset
.
none
/// A preset value for Depth.
internal
var
depthPreset
:
DepthPreset
{
...
...
@@ -317,14 +317,16 @@ extension CALayer {
/// Sets the shadow path.
open
func
layoutShadowPath
()
{
if
isShadowPathAutoSizing
{
if
.
none
==
depthPreset
{
shadowPath
=
nil
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
}
else
{
animate
(
animation
:
Animation
.
shadowPath
(
path
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
,
duration
:
0
))
}
guard
isShadowPathAutoSizing
else
{
return
}
if
.
none
==
depthPreset
{
shadowPath
=
nil
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
}
else
{
animate
(
animation
:
Animation
.
shadowPath
(
path
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
,
duration
:
0
))
}
}
}
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