Skip to content

Commit 403080b

Browse files
gonfunkosebjacobs
authored andcommitted
fix: show the correct toolbox based on sprites or the stage being selected (#4)
1 parent 9bf8f43 commit 403080b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/containers/blocks.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ class Blocks extends React.Component {
148148
// @todo change this when blockly supports UI events
149149
addFunctionListener(this.workspace, 'translate', this.onWorkspaceMetricsChange);
150150
addFunctionListener(this.workspace, 'zoom', this.onWorkspaceMetricsChange);
151+
this.workspace.getToolbox().selectItemByPosition(0);
151152

152153
this.attachVM();
153154
// Only update blocks/vm locale when visible to avoid sizing issues
@@ -224,11 +225,11 @@ class Blocks extends React.Component {
224225
this.ScratchBlocks.ScratchMsgs.setLocale(this.props.locale);
225226
this.props.vm.setLocale(this.props.locale, this.props.messages)
226227
.then(() => {
227-
// this.workspace.getFlyout().setRecyclingEnabled(false);
228+
this.workspace.getFlyout().setRecyclingEnabled(false);
228229
this.props.vm.refreshWorkspace();
229230
this.requestToolboxUpdate();
230231
this.withToolboxUpdates(() => {
231-
// this.workspace.getFlyout().setRecyclingEnabled(true);
232+
this.workspace.getFlyout().setRecyclingEnabled(true);
232233
});
233234
});
234235
}
@@ -239,6 +240,7 @@ class Blocks extends React.Component {
239240
// const categoryId = this.workspace.toolbox_.getSelectedItem().getId();
240241
// const offset = this.workspace.toolbox_.getCategoryScrollOffset();
241242
this.workspace.updateToolbox(this.props.toolboxXML);
243+
this.workspace.refreshToolboxSelection();
242244
this._renderedToolboxXML = this.props.toolboxXML;
243245

244246
// In order to catch any changes that mutate the toolbox during "normal runtime"

0 commit comments

Comments
 (0)