From 9a62f27303f3dc22bf5f62366a991ede67a23dad Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Sat, 8 May 2021 22:30:42 +0200 Subject: [PATCH] Remove unnecessary assertion Signed-off-by: Tilman Vatteroth --- src/components/editor-page/editor-pane/editor-pane.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/editor-page/editor-pane/editor-pane.tsx b/src/components/editor-page/editor-pane/editor-pane.tsx index 320ff859e..7d44986f7 100644 --- a/src/components/editor-page/editor-pane/editor-pane.tsx +++ b/src/components/editor-page/editor-pane/editor-pane.tsx @@ -105,15 +105,14 @@ export const EditorPane: React.FC = ({ onContentC if (!editor || !onScroll || !editorScroll) { return } - const scrollEventValue = editorScroll.top as number - const line = editor.lineAtHeight(scrollEventValue, 'local') + const line = editor.lineAtHeight(editorScroll.top, 'local') const startYOfLine = editor.heightAtLine(line, 'local') const lineInfo = editor.lineInfo(line) if (lineInfo === null) { return } const heightOfLine = (lineInfo.handle as { height: number }).height - const percentageRaw = (Math.max(scrollEventValue - startYOfLine, 0)) / heightOfLine + const percentageRaw = (Math.max(editorScroll.top - startYOfLine, 0)) / heightOfLine const percentage = Math.floor(percentageRaw * 100) const newScrollState: ScrollState = { firstLineInView: line + 1, scrolledPercentage: percentage }