Skip to content
Snippets Groups Projects
Commit 7b9e22c6 authored by Paul Kaplan's avatar Paul Kaplan
Browse files

Change the order of params to makeToolboxXML

parent 8aa1d6e3
No related branches found
No related tags found
No related merge requests found
......@@ -175,7 +175,7 @@ class Blocks extends React.Component {
// When we change sprites, update the toolbox to have the new sprite's blocks
if (this.props.vm.editingTarget) {
const target = this.props.vm.editingTarget;
this.props.updateToolboxState(makeToolboxXML(target.id, target.isStage));
this.props.updateToolboxState(makeToolboxXML(target.isStage, target.id));
}
if (this.props.vm.editingTarget && !this.state.workspaceMetrics[this.props.vm.editingTarget.id]) {
......@@ -202,7 +202,7 @@ class Blocks extends React.Component {
this.ScratchBlocks.defineBlocksWithJsonArray(blocksInfo.map(blockInfo => blockInfo.json));
const dynamicBlocksXML = this.props.vm.runtime.getBlocksXML();
const target = this.props.vm.editingTarget;
const toolboxXML = makeToolboxXML(target.id, target.isStage, dynamicBlocksXML);
const toolboxXML = makeToolboxXML(target.isStage, target.id, dynamicBlocksXML);
this.props.updateToolboxState(toolboxXML);
}
handleCategorySelected (categoryName) {
......
......@@ -2,7 +2,7 @@ const categorySeparator = '<sep gap="36"/>';
const blockSeparator = '<sep gap="36"/>'; // At default scale, about 28px
const motion = function (targetId, isStage) {
const motion = function (isStage, targetId) {
return `
<category name="Motion" colour="#4C97FF" secondaryColour="#3373CC">
${isStage ? `
......@@ -132,7 +132,7 @@ const motion = function (targetId, isStage) {
`;
};
const looks = function (targetId, isStage) {
const looks = function (isStage, targetId) {
return `
<category name="Looks" colour="#9966FF" secondaryColour="#774DCB">
${isStage ? '' : `
......@@ -346,7 +346,7 @@ const events = function () {
`;
};
const control = function (_targetId, isStage) {
const control = function (isStage) {
return `
<category name="Control" colour="#FFAB19" secondaryColour="#CF8B17">
<block type="control_wait">
......@@ -393,7 +393,7 @@ const control = function (_targetId, isStage) {
`;
};
const sensing = function (_targetId, isStage) {
const sensing = function (isStage) {
return `
<category name="Sensing" colour="#4CBFE6" secondaryColour="#2E8EB8">
${isStage ? '' : `
......@@ -658,24 +658,24 @@ const xmlOpen = '<xml style="display: none">';
const xmlClose = '</xml>';
/**
* @param {!string} targetId - The current editing target
* @param {!boolean} isStage - Whether the toolbox is for a stage-type target.
* @param {!string} targetId - The current editing target
* @param {string?} categoriesXML - null for default toolbox, or an XML string with <category> elements.
* @returns {string} - a ScratchBlocks-style XML document for the contents of the toolbox.
*/
const makeToolboxXML = function (targetId, isStage, categoriesXML) {
const makeToolboxXML = function (isStage, targetId, categoriesXML) {
const gap = [categorySeparator];
const everything = [
xmlOpen,
motion(targetId, isStage), gap,
looks(targetId, isStage), gap,
sound(targetId, isStage), gap,
events(targetId, isStage), gap,
control(targetId, isStage), gap,
sensing(targetId, isStage), gap,
operators(targetId, isStage), gap,
data(targetId, isStage)
motion(isStage, targetId), gap,
looks(isStage, targetId), gap,
sound(isStage, targetId), gap,
events(isStage, targetId), gap,
control(isStage, targetId), gap,
sensing(isStage, targetId), gap,
operators(isStage, targetId), gap,
data(isStage, targetId)
];
if (categoriesXML) {
......
......@@ -2,7 +2,7 @@ const UPDATE_TOOLBOX = 'scratch-gui/toolbox/UPDATE_TOOLBOX';
import makeToolboxXML from '../lib/make-toolbox-xml';
const initialState = {
toolboxXML: makeToolboxXML('', true)
toolboxXML: makeToolboxXML(true)
};
const reducer = function (state, action) {
......
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