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
6861382d
Commit
6861382d
authored
Aug 07, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: Updated Grid calculations
parent
35c09def
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
46 deletions
+35
-46
Sources/iOS/Grid.swift
+12
-23
Sources/iOS/MenuView.swift
+23
-23
No files found.
Sources/iOS/Grid.swift
View file @
6861382d
...
@@ -215,7 +215,6 @@ public class Grid {
...
@@ -215,7 +215,6 @@ public class Grid {
case
.
horizontal
:
case
.
horizontal
:
let
c
=
child
.
grid
.
columns
let
c
=
child
.
grid
.
columns
let
co
=
child
.
grid
.
offset
.
columns
let
co
=
child
.
grid
.
offset
.
columns
let
w
=
(
parent
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
-
layoutInset
.
left
-
layoutInset
.
right
+
interimSpace
)
/
CGFloat
(
gc
)
let
w
=
(
parent
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
-
layoutInset
.
left
-
layoutInset
.
right
+
interimSpace
)
/
CGFloat
(
gc
)
child
.
x
=
CGFloat
(
i
+
n
+
co
)
*
w
+
contentInset
.
left
+
layoutInset
.
left
child
.
x
=
CGFloat
(
i
+
n
+
co
)
*
w
+
contentInset
.
left
+
layoutInset
.
left
...
@@ -226,39 +225,29 @@ public class Grid {
...
@@ -226,39 +225,29 @@ public class Grid {
n
+=
c
+
co
-
1
n
+=
c
+
co
-
1
case
.
vertical
:
case
.
vertical
:
let
h
=
(
parent
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
-
layoutInset
.
top
-
layoutInset
.
bottom
+
interimSpace
)
/
CGFloat
(
gr
)
let
r
=
child
.
grid
.
rows
let
r
=
child
.
grid
.
rows
let
ro
=
child
.
grid
.
offset
.
rows
let
ro
=
child
.
grid
.
offset
.
rows
let
vw
=
parent
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
-
layoutInset
.
left
-
layoutInset
.
right
let
h
=
(
parent
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
-
layoutInset
.
top
-
layoutInset
.
bottom
+
interimSpace
)
/
CGFloat
(
gr
)
let
vt
=
CGFloat
(
i
+
n
+
ro
)
*
h
+
contentInset
.
top
+
layoutInset
.
top
let
vh
=
h
*
CGFloat
(
r
)
-
interimSpace
child
.
x
=
contentInset
.
left
+
layoutInset
.
left
child
.
x
=
contentInset
.
left
+
layoutInset
.
left
child
.
y
=
vt
child
.
y
=
CGFloat
(
i
+
n
+
ro
)
*
h
+
contentInset
.
top
+
layoutInset
.
top
child
.
width
=
vw
child
.
width
=
parent
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
-
layoutInset
.
left
-
layoutInset
.
right
child
.
height
=
vh
child
.
height
=
h
*
CGFloat
(
r
)
-
interimSpace
n
+=
r
+
ro
-
1
n
+=
r
+
ro
-
1
case
.
none
:
case
.
none
:
let
c
=
child
.
grid
.
columns
let
co
=
child
.
grid
.
offset
.
columns
var
w
=
(
parent
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
-
layoutInset
.
left
-
layoutInset
.
right
+
interimSpace
)
/
CGFloat
(
gc
)
var
h
=
(
parent
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
-
layoutInset
.
top
-
layoutInset
.
bottom
+
interimSpace
)
/
CGFloat
(
gr
)
let
r
=
child
.
grid
.
rows
let
r
=
child
.
grid
.
rows
let
ro
=
child
.
grid
.
offset
.
rows
let
ro
=
child
.
grid
.
offset
.
rows
let
x
=
CGFloat
(
co
)
*
w
+
contentInset
.
left
+
layoutInset
.
left
let
c
=
child
.
grid
.
columns
let
y
=
CGFloat
(
ro
)
*
h
+
contentInset
.
top
+
layoutInset
.
top
let
co
=
child
.
grid
.
offset
.
columns
let
w
=
(
parent
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
-
layoutInset
.
left
-
layoutInset
.
right
+
interimSpace
)
/
CGFloat
(
gc
)
w
=
w
*
CGFloat
(
c
)
-
interimSpace
let
h
=
(
parent
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
-
layoutInset
.
top
-
layoutInset
.
bottom
+
interimSpace
)
/
CGFloat
(
gr
)
h
=
h
*
CGFloat
(
r
)
-
interimSpace
child
.
x
=
x
child
.
x
=
CGFloat
(
co
)
*
w
+
contentInset
.
left
+
layoutInset
.
left
child
.
y
=
y
child
.
y
=
CGFloat
(
ro
)
*
h
+
contentInset
.
top
+
layoutInset
.
top
child
.
width
=
w
child
.
width
=
w
*
CGFloat
(
c
)
-
interimSpace
child
.
height
=
h
child
.
height
=
h
*
CGFloat
(
r
)
-
interimSpace
}
}
}
}
}
}
...
...
Sources/iOS/MenuView.swift
View file @
6861382d
...
@@ -42,6 +42,29 @@ public class MenuView : PulseView {
...
@@ -42,6 +42,29 @@ public class MenuView : PulseView {
/// References the Menu instance.
/// References the Menu instance.
public
private(set)
lazy
var
menu
:
Menu
=
Menu
()
public
private(set)
lazy
var
menu
:
Menu
=
Menu
()
public
override
func
hitTest
(
_
point
:
CGPoint
,
with
event
:
UIEvent
?)
->
UIView
?
{
/**
Since the subviews will be outside the bounds of this view,
we need to look at the subviews to see if we have a hit.
*/
guard
!
isHidden
else
{
return
nil
}
for
v
in
subviews
{
let
p
=
v
.
convert
(
point
,
from
:
self
)
if
v
.
bounds
.
contains
(
p
)
{
return
v
.
hitTest
(
p
,
with
:
event
)
}
}
if
menu
.
isOpened
{
(
delegate
as?
MenuViewDelegate
)?
.
menuViewDidTapOutside
?(
menuView
:
self
)
}
return
super
.
hitTest
(
point
,
with
:
event
)
}
/**
/**
Prepares the view instance when intialized. When subclassing,
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
it is recommended to override the prepareView method
...
@@ -89,27 +112,4 @@ public class MenuView : PulseView {
...
@@ -89,27 +112,4 @@ public class MenuView : PulseView {
}
}
}
}
}
}
public
override
func
hitTest
(
_
point
:
CGPoint
,
with
event
:
UIEvent
?)
->
UIView
?
{
/**
Since the subviews will be outside the bounds of this view,
we need to look at the subviews to see if we have a hit.
*/
guard
!
isHidden
else
{
return
nil
}
for
v
in
subviews
{
let
p
=
v
.
convert
(
point
,
from
:
self
)
if
v
.
bounds
.
contains
(
p
)
{
return
v
.
hitTest
(
p
,
with
:
event
)
}
}
if
menu
.
isOpened
{
(
delegate
as?
MenuViewDelegate
)?
.
menuViewDidTapOutside
?(
menuView
:
self
)
}
return
super
.
hitTest
(
point
,
with
:
event
)
}
}
}
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