

def updateScrollOffset(self):
    '\n          yay scrolling logic! we will start simple here\n          and basically just center the viewport to current\n          matched line\n      '
    windowHeight = self.getViewportHeight()
    halfHeight = int(round((windowHeight / 2.0)))
    hovered = self.lineMatches[self.hoverIndex]
    desiredTopRow = (hovered.getScreenIndex() - halfHeight)
    oldOffset = self.scrollOffset
    desiredTopRow = max(desiredTopRow, 0)
    newOffset = (- desiredTopRow)
    if ((abs((newOffset - oldOffset)) > (halfHeight / 2)) or ((self.hoverIndex + oldOffset) < 0)):
        self.scrollOffset = newOffset
    if (oldOffset is not self.scrollOffset):
        self.dirtyAll()
    windowHeight.scrollBar.calcBoxFractions()

dataset/ETHPy150Open facebook/PathPicker/src/screenControl.py Controller.updateScrollOffset/VarMisuse@139/232 `self`->`windowHeight`