Skip to content
Snippets Groups Projects
Commit 9166cb12 authored by Florrie's avatar Florrie
Browse files

Don't refer to scratchBlocksUtils from scratch-gui

parent c6c5d610
No related branches found
No related tags found
No related merge requests found
...@@ -245,9 +245,15 @@ export default function (vm) { ...@@ -245,9 +245,15 @@ export default function (vm) {
// The block was in the flyout so look up future block info there. // The block was in the flyout so look up future block info there.
lookupBlocks = vm.runtime.flyoutBlocks; lookupBlocks = vm.runtime.flyoutBlocks;
} }
const sort = function (options) {
options.sort((str1, str2) => str1.localeCompare(str2, [], {
sensitivity: 'base',
numeric: true
}));
};
// Get all the stage variables (no lists) so we can add them to menu when the stage is selected. // Get all the stage variables (no lists) so we can add them to menu when the stage is selected.
const stageVariableOptions = vm.runtime.getTargetForStage().getAllVariableNamesInScopeByType(''); const stageVariableOptions = vm.runtime.getTargetForStage().getAllVariableNamesInScopeByType('');
stageVariableOptions.sort(ScratchBlocks.scratchBlocksUtils.compareStrings); sort(stageVariableOptions);
const stageVariableMenuItems = stageVariableOptions.map(variable => [variable, variable]); const stageVariableMenuItems = stageVariableOptions.map(variable => [variable, variable]);
if (sensingOfBlock.inputs.OBJECT.shadow !== sensingOfBlock.inputs.OBJECT.block) { if (sensingOfBlock.inputs.OBJECT.shadow !== sensingOfBlock.inputs.OBJECT.block) {
// There's a block dropped on top of the menu. It'd be nice to evaluate it and // There's a block dropped on top of the menu. It'd be nice to evaluate it and
...@@ -266,7 +272,7 @@ export default function (vm) { ...@@ -266,7 +272,7 @@ export default function (vm) {
// The target should exist, but there are ways for it not to (e.g. #4203). // The target should exist, but there are ways for it not to (e.g. #4203).
if (target) { if (target) {
spriteVariableOptions = target.getAllVariableNamesInScopeByType('', true); spriteVariableOptions = target.getAllVariableNamesInScopeByType('', true);
spriteVariableOptions.sort(ScratchBlocks.scratchBlocksUtils.compareStrings); sort(spriteVariableOptions);
} }
const spriteVariableMenuItems = spriteVariableOptions.map(variable => [variable, variable]); const spriteVariableMenuItems = spriteVariableOptions.map(variable => [variable, variable]);
return spriteOptions.concat(spriteVariableMenuItems); return spriteOptions.concat(spriteVariableMenuItems);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment