Skip to content

Commit

Permalink
Allow negative scroll margins
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Nov 2, 2023
1 parent cecef4e commit b954fa2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/docview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,11 @@ export class DocView extends ContentView {
left: rect.left - margins.left, top: rect.top - margins.top,
right: rect.right + margins.right, bottom: rect.bottom + margins.bottom
}
let sDOM = this.view.scrollDOM
let {offsetWidth, offsetHeight} = this.view.scrollDOM
scrollRectIntoView(this.view.scrollDOM, targetRect, range.head < range.anchor ? -1 : 1,
target.x, target.y,
Math.max(0, Math.min(target.xMargin, sDOM.offsetWidth)),
Math.max(0, Math.min(target.yMargin, sDOM.offsetHeight)),
Math.max(Math.min(target.xMargin, offsetWidth), -offsetWidth),
Math.max(Math.min(target.yMargin, offsetHeight), -offsetHeight),
this.view.textDirection == Direction.LTR)
}

Expand Down

0 comments on commit b954fa2

Please sign in to comment.