Browse Source

Update scroll-past-end padding to show the last cell at the top of the panel.

Jason Grout 6 years ago
parent
commit
663f4523c8

+ 8 - 1
packages/theme-dark-extension/style/variables.css

@@ -277,10 +277,17 @@ all of MD as it is not optimized for dense, information rich UIs.
   /* Notebook specific styles */
 
   --jp-notebook-padding: 10px;
-  --jp-notebook-scroll-padding: 50%;
   --jp-notebook-select-background: var(--jp-layout-color1);
   --jp-notebook-multiselected-color: rgba(33, 150, 243, 0.24);
 
+  /* The scroll padding is calculated to fill enough space at the bottom of the
+  notebook to show one single-line cell (with appropriate padding) at the top
+  when the notebook is scrolled all the way to the bottom. We also subtract one
+  pixel so that no scrollbar appears if we have just one single-line cell in the
+  notebook. This padding is to enable a 'scroll past end' feature in a notebook.
+  */
+  --jp-notebook-scroll-padding: calc(100% - var(--jp-code-font-size)*var(--jp-code-line-height) - var(--jp-code-padding) - var(--jp-cell-padding) - 1px);
+
   /* Rendermime styles */
 
   --jp-rendermime-error-background: rgba(244, 67, 54, 0.28);

+ 8 - 1
packages/theme-light-extension/style/variables.css

@@ -274,10 +274,17 @@ all of MD as it is not optimized for dense, information rich UIs.
   /* Notebook specific styles */
 
   --jp-notebook-padding: 10px;
-  --jp-notebook-scroll-padding: 50%;
   --jp-notebook-select-background: var(--jp-layout-color1);
   --jp-notebook-multiselected-color: var(--md-blue-50);
 
+  /* The scroll padding is calculated to fill enough space at the bottom of the
+  notebook to show one single-line cell (with appropriate padding) at the top
+  when the notebook is scrolled all the way to the bottom. We also subtract one
+  pixel so that no scrollbar appears if we have just one single-line cell in the
+  notebook. This padding is to enable a 'scroll past end' feature in a notebook.
+  */
+  --jp-notebook-scroll-padding: calc(100% - var(--jp-code-font-size)*var(--jp-code-line-height) - var(--jp-code-padding) - var(--jp-cell-padding) - 1px);
+
   /* Rendermime styles */
 
   --jp-rendermime-error-background: #fdd;