 		var frame = view.bounds
 		frame.size.height = CollectionViewModel.height
 		frame.origin.y = (view.bounds.height - frame.height) * 0.5
-		collectionView.frame = frame
-		
-
-		let halfWidth = round(frame.width/2)-1
-		collectionView.contentInset = UIEdgeInsets(top: 0, left: halfWidth, bottom: 0, right: halfWidth)
+		myView.frame = frame
 
 		
 		titleLabel.sizeToFit()

		instance.userInteractionEnabled = false
		return instance
	}()
	
	override func layoutSubviews() {
		super.layoutSubviews()

		let (leftFrame, rightFrame) = bounds.divide(round(bounds.width/2), fromEdge: .MinXEdge)
		leftCoverView.frame = CGRect(x: leftFrame.origin.x, y: leftFrame.origin.y, width: leftFrame.size.width - 1, height: leftFrame.size.height)
		rightCoverView.frame = rightFrame
	}
}

class FlowLayout: UICollectionViewFlowLayout {
	weak var model: CollectionViewModel?
	
	override func layoutAttributesForSupplementaryViewOfKind(elementKind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? {
		return nil
	}
	
	override func prepareLayout() {
		super.prepareLayout()
		
		scrollDirection = .Horizontal
		minimumInteritemSpacing = 0
		minimumLineSpacing = 0
		sectionInset = UIEdgeInsetsZero
		headerReferenceSize = CGSizeZero
		footerReferenceSize = CGSizeZero
	}
	
	override func collectionViewContentSize() -> CGSize {
		guard let model = self.model else {
			return CGSizeZero
		}
		return CGSize(width: model.scaleRounded * CGFloat(model.count), height: CollectionViewModel.height)
	}
}

class SliderCell: UICollectionViewCell {
	static let identifier = "cell"
	
	override init(frame: CGRect) {
		super.init(frame: frame)
		commonInit()
	}
	
	required init?(coder aDecoder: NSCoder) {
		super.init(coder: aDecoder)
		commonInit()
	}
	
	func commonInit() {
		backgroundColor = UIColor.whiteColor()
		addSubview(leftBorder)
		addSubview(label)
	}
	
	lazy var leftBorder: UIView = {
		let instance = UIView()
		instance.backgroundColor = UIColor.blackColor()
		return instance
	}()
	
	lazy var label: UILabel = {
		let instance = UILabel()
		instance.text = "42"
		return instance
	}()
	
	override func layoutSubviews() {
		super.layoutSubviews()
		leftBorder.frame = CGRect(x: 0, y: 0, width: 1, height: bounds.height)
		
		let labelHidden = self.bounds.width < 30
		label.hidden = labelHidden

		label.sizeToFit()
		let labelFrame = label.frame
		label.frame = CGRect(x: 7, y: 5, width: bounds.width - 10, height: labelFrame.height)
	}
}

class ScientificSliderViewController2: UIViewController, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource, UIScrollViewDelegate, UIGestureRecognizerDelegate {
	
	var originalScale: CGFloat = 1.0
	var originalValue: CGFloat?

	
	override func loadView() {
		super.loadView()
		self.automaticallyAdjustsScrollViewInsets = false
		
		view.backgroundColor = UIColor.lightGrayColor()
		view.addSubview(collectionView)
		view.addSubview(titleLabel)
		view.addSubview(valueLabel)
		view.addSubview(usageLabel)
	}
	
	lazy var model: CollectionViewModel = {
		let instance = CollectionViewModel()
		return instance
	}()
	
	lazy var usageLabel: UILabel = {
		let instance = UILabel()
		instance.text = "Pinch to adjust magnitude.\n\nPan left/right to adjust value."
		instance.numberOfLines = 0
		instance.textAlignment = .Center
		instance.font = UIFont.systemFontOfSize(17)
		return instance
	}()
	
	lazy var titleLabel: UILabel = {
		let instance = UILabel()
		instance.text = "Value"
		instance.numberOfLines = 0
		instance.textAlignment = .Left
		instance.font = UIFont.boldSystemFontOfSize(18)
		return instance
	}()
	
	lazy var valueLabel: UILabel = {
		let instance = UILabel()
		instance.text = "-"
		instance.numberOfLines = 0
		instance.textAlignment = .Right
		instance.font = UIFont.systemFontOfSize(20)
		return instance
	}()

	func updateLabel() {
		if let value = self.value {
			valueLabel.text = String(format: "%.3f", value)
		} else {
			valueLabel.text = "---"
		}
	}
	
	var value: CGFloat? {
		let scale = model.scaleRounded

	}
	
	func commonInit() {
		backgroundColor = UIColor.whiteColor()
		addSubview(leftBorder)
		addSubview(label)
	}
	
	lazy var leftBorder: UIView = {
		let instance = UIView()
		instance.backgroundColor = UIColor.blackColor()
		return instance
	}()
	
	lazy var label: UILabel = {
		let instance = UILabel()
		instance.text = "0"
		return instance
	}()
	
	override func layoutSubviews() {
		super.layoutSubviews()
		leftBorder.frame = CGRect(x: 0, y: 0, width: 1, height: bounds.height)
		
		let labelHidden = self.bounds.width < 30
		label.hidden = labelHidden

		label.sizeToFit()
		let labelFrame = label.frame
		label.frame = CGRect(x: 7, y: 5, width: bounds.width - 10, height: labelFrame.height)
	}
}

class MyView: UIView, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource, UIScrollViewDelegate, UIGestureRecognizerDelegate {
	var originalScale: CGFloat = 1.0
	var originalValue: CGFloat?
	
	typealias ValueDidChange = Void -> Void
	var valueDidChange: ValueDidChange?

	override init(frame: CGRect) {
		super.init(frame: frame)
		commonInit()
	}
	required init?(coder aDecoder: NSCoder) {
		super.init(coder: aDecoder)
		commonInit()
	}

	func commonInit() {
		addSubview(collectionView)
		addSubview(leftCoverView)
		addSubview(rightCoverView)
	}
	
	func viewWillAppear() {
		addGestureRecognizer(pinchGestureRecognizer)
		
		layout.itemSize = computeItemSize()
		layout.invalidateLayout()
		collectionView.reloadData()
	}
	
	func viewDidDisappear() {
		removeGestureRecognizer(pinchGestureRecognizer)
	}
	
	override func layoutSubviews() {
		super.layoutSubviews()
		collectionView.frame = bounds
		
		let halfWidth = round(bounds.width/2)-1
		collectionView.contentInset = UIEdgeInsets(top: 0, left: halfWidth, bottom: 0, right: halfWidth)

		let (leftFrame, rightFrame) = bounds.divide(round(bounds.width/2), fromEdge: .MinXEdge)
		leftCoverView.frame = CGRect(x: leftFrame.origin.x, y: leftFrame.origin.y, width: leftFrame.size.width - 1, height: leftFrame.size.height)
		rightCoverView.frame = rightFrame
	}

	lazy var leftCoverView: UIView = {
		let instance = UIView()
		instance.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.2)
