Fix wrong height of last block background layer

This commit is contained in:
Jonatan Heyman 2023-01-12 18:01:54 +01:00
parent e880387128
commit ce531aa854

View File

@ -183,7 +183,12 @@ const blockLayer = layer({
const fromCoordsTop = view.coordsAtPos(Math.max(block.content.from, view.visibleRanges[0].from)).top const fromCoordsTop = view.coordsAtPos(Math.max(block.content.from, view.visibleRanges[0].from)).top
let toCoordsBottom = view.coordsAtPos(Math.min(block.content.to, view.visibleRanges[view.visibleRanges.length - 1].to)).bottom let toCoordsBottom = view.coordsAtPos(Math.min(block.content.to, view.visibleRanges[view.visibleRanges.length - 1].to)).bottom
if (idx === blocks.length - 1) { if (idx === blocks.length - 1) {
let extraHeight = view.viewState.editorHeight - view.defaultLineHeight - view.documentPadding.top - 0.5 // Calculate how much extra height we need to add to the last block
let extraHeight = view.viewState.editorHeight - (
view.defaultLineHeight + // when scrolling furthest down, one line is still shown at the top
view.documentPadding.top +
7
)
toCoordsBottom += extraHeight toCoordsBottom += extraHeight
} }
markers.push(new RectangleMarker( markers.push(new RectangleMarker(