     var leftOverflowIndicator : CAGradientLayer = CAGradientLayer()
     var rightOverflowIndicator : CAGradientLayer = CAGradientLayer()
 
+    var isVisible:Bool {
+        return self.view.alpha > 0
+    }
+    
     init() {
         super.init(nibName: nil, bundle: nil)
 

    }

    func removeTab(tab: TabWidget) {
        let w = calcTabWidth(tabs.count - 1)
        var index = 0

        tab.title.snp_removeConstraints()
        tab.title.hidden = true
        
        UIView.animateWithDuration(0.2, animations: {
            tab.alpha = 0
            for (i, item) in self.tabs.enumerate() {
                if item === tab {
                    index = i
                    item.widthConstraint?.updateOffset(0)
                } else {
                    item.widthConstraint?.updateOffset(w)
                }
            }

            self.scrollView.setNeedsLayout()
            self.updateContentSize(self.tabs.count - 1)
        }) { _ in
            let prev = self.neighborSpacer(index - 1)
            let next = self.neighborTab(index + 1)
            next?.snp_makeConstraints(closure: { (make) in
                if let prev = prev {
                    make.left.equalTo(prev.snp_right)
                }
            })

            tab.spacerRight.removeFromSuperview()
            tab.removeFromSuperview()
            self.tabs.removeAtIndex(index)
            self.overflowIndicators()
        }

    }

    func addLeftRightScrollHint(isRightSide isRightSide: Bool, maskLayer: CAGradientLayer) {

        let c = calc()
        return c > 0 ? c : UIScreen.mainScreen().bounds.width
    }
    
    func recalculateTabView() {
        let w = calcTabWidth(tabs.count)
        self.updateTabWidthConstraint(width: w)
        
        updateContentSize(tabs.count)
        overflowIndicators()
        
        self.scrollView.layoutIfNeeded()
    }


    func addTab(browser browser: Browser) -> TabWidget {
        
        let t = TabWidget(browser: browser, parentScrollView: scrollView)
        t.delegate = self
        
        t.widthConstraint?.updateOffset(0)
        
        self.scrollView.addSubview(t)
        
        let w = calcTabWidth(tabs.count)
        
        t.remakeLayout(prev: tabs.last?.spacerRight != nil ? tabs.last!.spacerRight : self.spacerLeftmost, width: w, scrollView: self.scrollView)
        
        tabs.append(t)
        
        if !self.isVisible {
            recalculateTabView()
        }
        else {
            UIView.animateWithDuration(0.2, animations: {
                self.recalculateTabView()
            })
        }
        
        return t
    }

    func neighborSpacer(i: Int) -> UIView? {
        if i < 0 {
