Skip to content
Snippets Groups Projects
Commit ed1eee71 authored by Eric Rosenbaum's avatar Eric Rosenbaum
Browse files

hold scroll position on switching sprites

parent c031e2d2
Branches
No related tags found
No related merge requests found
...@@ -95,9 +95,11 @@ class Blocks extends React.Component { ...@@ -95,9 +95,11 @@ class Blocks extends React.Component {
} }
if (prevProps.toolboxXML !== this.props.toolboxXML) { 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.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) { if (this.props.isVisible === prevProps.isVisible) {
return; return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment