From ed1eee713fa814337272825bb90ec264a6276e5e Mon Sep 17 00:00:00 2001
From: Eric Rosenbaum <eric.rosenbaum@gmail.com>
Date: Wed, 14 Mar 2018 21:01:08 -0400
Subject: [PATCH] hold scroll position on switching sprites

---
 src/containers/blocks.jsx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/containers/blocks.jsx b/src/containers/blocks.jsx
index bedbbdbad..504291036 100644
--- a/src/containers/blocks.jsx
+++ b/src/containers/blocks.jsx
@@ -95,9 +95,11 @@ class Blocks extends React.Component {
         }
 
         if (prevProps.toolboxXML !== this.props.toolboxXML) {
-            const selectedCategoryName = this.workspace.toolbox_.getSelectedItem().name_;
+            const categoryName = this.workspace.toolbox_.getSelectedCategoryName();
+            const offset = this.workspace.toolbox_.getCategoryScrollOffset();
             this.workspace.updateToolbox(this.props.toolboxXML);
-            this.workspace.toolbox_.setSelectedCategoryByName(selectedCategoryName);
+            const currentCategoryPos = this.workspace.toolbox_.getCategoryPositionByName(categoryName);
+            this.workspace.toolbox_.setFlyoutScrollPos(currentCategoryPos + offset);
         }
         if (this.props.isVisible === prevProps.isVisible) {
             return;
-- 
GitLab