Add window padding to scrollView document height
parent
ffead466c7
commit
51b2374616
|
|
@ -226,11 +226,17 @@ class SurfaceScrollView: NSView {
|
|||
// Convert row units to pixels using cell height, ignore zero height.
|
||||
let cellHeight = surfaceView.cellSize.height
|
||||
guard cellHeight > 0 else { return }
|
||||
|
||||
|
||||
// The full document height must include the vertical padding around the cell
|
||||
// grid, otherwise the content view ends up misaligned with the surface.
|
||||
let documentGridHeight = CGFloat(scrollbar.total) * cellHeight
|
||||
let gridHeight = CGFloat(scrollbar.len) * cellHeight
|
||||
let padding = scrollView.contentSize.height - gridHeight
|
||||
let documentHeight = documentGridHeight + padding
|
||||
|
||||
// Our width should be the content width to account for visible scrollers.
|
||||
// We don't do horizontal scrolling in terminals.
|
||||
let totalHeight = CGFloat(scrollbar.total) * cellHeight
|
||||
let newSize = CGSize(width: scrollView.contentSize.width, height: totalHeight)
|
||||
let newSize = CGSize(width: scrollView.contentSize.width, height: documentHeight)
|
||||
documentView.setFrameSize(newSize)
|
||||
|
||||
// Only update our actual scroll position if we're not actively scrolling.
|
||||
|
|
|
|||
Loading…
Reference in New Issue