Skip to content

Commit

Permalink
Fixed: View gets scrolled to top after zooming out instead of keeping…
Browse files Browse the repository at this point in the history
… active line on screen #45
  • Loading branch information
vslinko committed Dec 21, 2021
1 parent 88e6ace commit 4431972
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/logic/KeepOnlyZoomedContentVisible.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,25 @@ export class KeepOnlyZoomedContentVisible {
view.dispatch({
effects: [effect],
});
view.dispatch({
effects: [
EditorView.scrollIntoView(view.state.selection.main, {
y: "start",
}),
],
});
}

public showAllContent(view: EditorView) {
this.logger.log("KeepOnlyZoomedContent:showAllContent", "show all content");

view.dispatch({ effects: [zoomOutEffect.of()] });
view.dispatch({
effects: [
EditorView.scrollIntoView(view.state.selection.main, {
y: "center",
}),
],
});
}
}

0 comments on commit 4431972

Please sign in to comment.