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
9707a8f6
Commit
9707a8f6
authored
Sep 12, 2018
by
Orkhan Alikhanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed DepthPreset.root to rawValue
parent
5566ea5b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
Sources/iOS/Depth.swift
+15
-13
Sources/iOS/Material+CALayer.swift
+1
-1
No files found.
Sources/iOS/Depth.swift
View file @
9707a8f6
...
...
@@ -42,16 +42,17 @@ public enum DepthPreset {
indirect
case
left
(
DepthPreset
)
indirect
case
right
(
DepthPreset
)
public
var
root
:
DepthPreset
{
/// Returns raw depth value without considering direction.
public
var
rawValue
:
DepthPreset
{
switch
self
{
case
.
above
(
let
v
):
return
v
.
r
oot
return
v
.
r
awValue
case
.
below
(
let
v
):
return
v
.
r
oot
return
v
.
r
awValue
case
.
left
(
let
v
):
return
v
.
r
oot
return
v
.
r
awValue
case
.
right
(
let
v
):
return
v
.
r
oot
return
v
.
r
awValue
default
:
return
self
}
...
...
@@ -133,8 +134,8 @@ public func DepthPresetToValue(preset: DepthPreset) -> Depth {
if
preset
.
isRoot
{
v
.
offset
.
vertical
*=
-
1
}
else
{
let
root
=
DepthPresetToValue
(
preset
:
preset
.
root
)
v
.
offset
.
vertical
-=
root
.
offset
.
vertical
let
value
=
DepthPresetToValue
(
preset
:
preset
.
rawValue
)
v
.
offset
.
vertical
-=
value
.
offset
.
vertical
}
return
v
case
.
below
(
let
preset
):
...
...
@@ -142,8 +143,8 @@ public func DepthPresetToValue(preset: DepthPreset) -> Depth {
if
preset
.
isRoot
{
return
v
}
else
{
let
root
=
DepthPresetToValue
(
preset
:
preset
.
root
)
v
.
offset
.
vertical
+=
root
.
offset
.
vertical
let
value
=
DepthPresetToValue
(
preset
:
preset
.
rawValue
)
v
.
offset
.
vertical
+=
value
.
offset
.
vertical
}
return
v
case
.
left
(
let
preset
):
...
...
@@ -152,8 +153,8 @@ public func DepthPresetToValue(preset: DepthPreset) -> Depth {
v
.
offset
.
horizontal
=
-
v
.
offset
.
vertical
v
.
offset
.
vertical
=
0
}
else
{
let
root
=
DepthPresetToValue
(
preset
:
preset
.
root
)
v
.
offset
.
horizontal
-=
root
.
offset
.
vertical
let
value
=
DepthPresetToValue
(
preset
:
preset
.
rawValue
)
v
.
offset
.
horizontal
-=
value
.
offset
.
vertical
}
return
v
case
.
right
(
let
preset
):
...
...
@@ -162,14 +163,15 @@ public func DepthPresetToValue(preset: DepthPreset) -> Depth {
v
.
offset
.
horizontal
=
v
.
offset
.
vertical
v
.
offset
.
vertical
=
0
}
else
{
let
root
=
DepthPresetToValue
(
preset
:
preset
.
root
)
v
.
offset
.
horizontal
+=
root
.
offset
.
vertical
let
value
=
DepthPresetToValue
(
preset
:
preset
.
rawValue
)
v
.
offset
.
horizontal
+=
value
.
offset
.
vertical
}
return
v
}
}
fileprivate
extension
DepthPreset
{
/// Checks if the preset is the root value (has no direction).
var
isRoot
:
Bool
{
switch
self
{
case
.
above
(
_
):
...
...
Sources/iOS/Material+CALayer.swift
View file @
9707a8f6
...
...
@@ -281,7 +281,7 @@ extension CALayer {
return
}
if
case
.
none
=
depthPreset
.
r
oot
{
if
case
.
none
=
depthPreset
.
r
awValue
{
shadowPath
=
nil
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
...
...
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