From 6441cf935238d8ed7c885d16f41ff0ac7c1fdbc3 Mon Sep 17 00:00:00 2001 From: David Kutugata Date: Thu, 5 Sep 2019 14:05:50 -0700 Subject: [PATCH] check the position of the scroll in the interactive (#7198) * check the position of the scroll in the interactive window, if it is at the bottom, the screen stays at the bottom, and if not, the screen stays in place. Throttling of the scroll was increased to help with consistency on rapidly appearing plots. * handle the scroll in the MainPanel, tested to work with: - regular code, -dataframes, -big and regular plots. * Added some comments. --- news/2 Fixes/6580.md | 6 ++++ .../history-react/MainPanel.tsx | 29 +++++++++++++++++-- .../history-react/contentPanel.tsx | 10 ++----- .../history-react/mainPanelState.ts | 4 ++- 4 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 news/2 Fixes/6580.md diff --git a/news/2 Fixes/6580.md b/news/2 Fixes/6580.md new file mode 100644 index 000000000000..aa561e6c0150 --- /dev/null +++ b/news/2 Fixes/6580.md @@ -0,0 +1,6 @@ +Changed the way scrolling is treated. Now we only check for the position of the scroll, the size of the cell won't matter. +Still the interactive window will snap to the bottom if you already are at the bottom, and will stay in place if you are not. Like a chat window. +Tested to work with: +- regular code +- dataframes +- big and regular plots \ No newline at end of file diff --git a/src/datascience-ui/history-react/MainPanel.tsx b/src/datascience-ui/history-react/MainPanel.tsx index 5fdbbd56ec63..c8d9af4f3fd6 100644 --- a/src/datascience-ui/history-react/MainPanel.tsx +++ b/src/datascience-ui/history-react/MainPanel.tsx @@ -41,6 +41,7 @@ export class MainPanel extends React.Component private stackLimit = 10; private updateCount = 0; private renderCount = 0; + private internalScrollCount = 0; private editCellRef: Cell | null = null; private mainPanel: HTMLDivElement | null = null; private variableExplorerRef: React.RefObject; @@ -68,7 +69,8 @@ export class MainPanel extends React.Component editorOptions: this.computeEditorOptions(), currentExecutionCount: 0, debugging: false, - enableGather: getSettings && getSettings().enableGather + enableGather: getSettings && getSettings().enableGather, + isAtBottom: true }; // Add test state if necessary @@ -151,7 +153,7 @@ export class MainPanel extends React.Component
{this.renderVariablePanel(baseTheme)}
-
+
{this.renderContentPanel(baseTheme)}