Commit 5586d0ae by danieldahan

fixed issue where BarView.contentInsets were not respecting sizes in Controller mode

parent 602f184d
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '1.41.3' s.version = '1.41.4'
s.license = 'BSD-3-Clause' s.license = 'BSD-3-Clause'
s.summary = 'An animation and graphics framework for Material Design in Swift.' s.summary = 'An animation and graphics framework for Material Design in Swift.'
s.homepage = 'http://cosmicmind.io' s.homepage = 'http://cosmicmind.io'
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.41.3</string> <string>1.41.4</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -212,6 +212,7 @@ public class ControlView : MaterialView { ...@@ -212,6 +212,7 @@ public class ControlView : MaterialView {
grid.contentInset = contentInset grid.contentInset = contentInset
grid.spacing = spacing grid.spacing = spacing
grid.reloadLayout() grid.reloadLayout()
contentView.grid.reloadLayout()
} }
} }
} }
......
...@@ -204,18 +204,18 @@ public class Grid { ...@@ -204,18 +204,18 @@ public class Grid {
let c: Int = view.grid.columns let c: Int = view.grid.columns
let co: Int = view.grid.offset.columns let co: Int = view.grid.offset.columns
let vh: CGFloat = sv.bounds.height - contentInset.top - contentInset.bottom - layoutInset.top - layoutInset.bottom let vh: CGFloat = sv.bounds.height - contentInset.top - contentInset.bottom - layoutInset.top - layoutInset.bottom
let vl: CGFloat = CGFloat(i + n + co) * w + contentInset.left let vl: CGFloat = CGFloat(i + n + co) * w + contentInset.left + layoutInset.left
let vw: CGFloat = w * CGFloat(c) - spacing let vw: CGFloat = w * CGFloat(c) - spacing
view.frame = CGRectMake(vl, contentInset.top, vw, vh) view.frame = CGRectMake(vl, contentInset.top + layoutInset.top, vw, vh)
n += c + co - 1 n += c + co - 1
case .Vertical: case .Vertical:
let h: CGFloat = (sv.bounds.height - contentInset.top - contentInset.bottom - layoutInset.top - layoutInset.bottom + spacing) / CGFloat(gr) let h: CGFloat = (sv.bounds.height - contentInset.top - contentInset.bottom - layoutInset.top - layoutInset.bottom + spacing) / CGFloat(gr)
let r: Int = view.grid.rows let r: Int = view.grid.rows
let ro: Int = view.grid.offset.rows let ro: Int = view.grid.offset.rows
let vw: CGFloat = sv.bounds.width - contentInset.left - contentInset.right - layoutInset.left - layoutInset.right let vw: CGFloat = sv.bounds.width - contentInset.left - contentInset.right - layoutInset.left - layoutInset.right
let vt: CGFloat = CGFloat(i + n + ro) * h + contentInset.top let vt: CGFloat = CGFloat(i + n + ro) * h + contentInset.top + layoutInset.top
let vh: CGFloat = h * CGFloat(r) - spacing let vh: CGFloat = h * CGFloat(r) - spacing
view.frame = CGRectMake(contentInset.left, vt, vw, vh) view.frame = CGRectMake(contentInset.left + layoutInset.left, vt, vw, vh)
n += r + ro - 1 n += r + ro - 1
case .None: case .None:
let w: CGFloat = (sv.bounds.width - contentInset.left - contentInset.right - layoutInset.left - layoutInset.right + spacing) / CGFloat(gc) let w: CGFloat = (sv.bounds.width - contentInset.left - contentInset.right - layoutInset.left - layoutInset.right + spacing) / CGFloat(gc)
...@@ -224,8 +224,8 @@ public class Grid { ...@@ -224,8 +224,8 @@ public class Grid {
let h: CGFloat = (sv.bounds.height - contentInset.top - contentInset.bottom - layoutInset.top - layoutInset.bottom + spacing) / CGFloat(gr) let h: CGFloat = (sv.bounds.height - contentInset.top - contentInset.bottom - layoutInset.top - layoutInset.bottom + spacing) / CGFloat(gr)
let r: Int = view.grid.rows let r: Int = view.grid.rows
let ro: Int = view.grid.offset.rows let ro: Int = view.grid.offset.rows
let vt: CGFloat = CGFloat(ro) * h + contentInset.top let vt: CGFloat = CGFloat(ro) * h + contentInset.top + layoutInset.top
let vl: CGFloat = CGFloat(co) * w + contentInset.left let vl: CGFloat = CGFloat(co) * w + contentInset.left + layoutInset.left
let vh: CGFloat = h * CGFloat(r) - spacing let vh: CGFloat = h * CGFloat(r) - spacing
let vw: CGFloat = w * CGFloat(c) - spacing let vw: CGFloat = w * CGFloat(c) - spacing
view.frame = CGRectMake(vl, vt, vw, vh) view.frame = CGRectMake(vl, vt, vw, vh)
......
...@@ -60,17 +60,13 @@ public class SearchBarController : BarController { ...@@ -60,17 +60,13 @@ public class SearchBarController : BarController {
/// Layout subviews. /// Layout subviews.
public func layoutSubviews() { public func layoutSubviews() {
if let v: SearchBar = searchBar { if let v: SearchBar = searchBar {
if .iPhone == MaterialDevice.type && MaterialDevice.isLandscape { v.grid.layoutInset.top = .iPhone == MaterialDevice.type && MaterialDevice.isLandscape ? 0 : 20
v.contentInset.top = 4
} else {
v.contentInset.top = 24
}
let h: CGFloat = MaterialDevice.height let h: CGFloat = MaterialDevice.height
let w: CGFloat = MaterialDevice.width let w: CGFloat = MaterialDevice.width
let p: CGFloat = searchBar.intrinsicContentSize().height let p: CGFloat = v.intrinsicContentSize().height + v.grid.layoutInset.top + v.grid.layoutInset.bottom
v.width = w v.width = w + v.grid.layoutInset.left + v.grid.layoutInset.right
v.height = p v.height = p
rootViewController.view.frame.origin.y = p rootViewController.view.frame.origin.y = p
......
...@@ -163,9 +163,9 @@ public class ToolbarController : BarController { ...@@ -163,9 +163,9 @@ public class ToolbarController : BarController {
let h: CGFloat = MaterialDevice.height let h: CGFloat = MaterialDevice.height
let w: CGFloat = MaterialDevice.width let w: CGFloat = MaterialDevice.width
let p: CGFloat = v.intrinsicContentSize().height + v.grid.layoutInset.top let p: CGFloat = v.intrinsicContentSize().height + v.grid.layoutInset.top + v.grid.layoutInset.bottom
v.width = w v.width = w + v.grid.layoutInset.left + v.grid.layoutInset.right
v.height = p v.height = p
rootViewController.view.frame.origin.y = p rootViewController.view.frame.origin.y = p
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment