Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Goessmann
logging-scratch-gui
Commits
7b9e22c6
Commit
7b9e22c6
authored
7 years ago
by
Paul Kaplan
Browse files
Options
Downloads
Patches
Plain Diff
Change the order of params to makeToolboxXML
parent
8aa1d6e3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/containers/blocks.jsx
+2
-2
2 additions, 2 deletions
src/containers/blocks.jsx
src/lib/make-toolbox-xml.js
+14
-14
14 additions, 14 deletions
src/lib/make-toolbox-xml.js
src/reducers/toolbox.js
+1
-1
1 addition, 1 deletion
src/reducers/toolbox.js
with
17 additions
and
17 deletions
src/containers/blocks.jsx
+
2
−
2
View file @
7b9e22c6
...
@@ -175,7 +175,7 @@ class Blocks extends React.Component {
...
@@ -175,7 +175,7 @@ class Blocks extends React.Component {
// When we change sprites, update the toolbox to have the new sprite's blocks
// When we change sprites, update the toolbox to have the new sprite's blocks
if
(
this
.
props
.
vm
.
editingTarget
)
{
if
(
this
.
props
.
vm
.
editingTarget
)
{
const
target
=
this
.
props
.
vm
.
editingTarget
;
const
target
=
this
.
props
.
vm
.
editingTarget
;
this
.
props
.
updateToolboxState
(
makeToolboxXML
(
target
.
i
d
,
target
.
i
sStage
));
this
.
props
.
updateToolboxState
(
makeToolboxXML
(
target
.
i
sStage
,
target
.
i
d
));
}
}
if
(
this
.
props
.
vm
.
editingTarget
&&
!
this
.
state
.
workspaceMetrics
[
this
.
props
.
vm
.
editingTarget
.
id
])
{
if
(
this
.
props
.
vm
.
editingTarget
&&
!
this
.
state
.
workspaceMetrics
[
this
.
props
.
vm
.
editingTarget
.
id
])
{
...
@@ -202,7 +202,7 @@ class Blocks extends React.Component {
...
@@ -202,7 +202,7 @@ class Blocks extends React.Component {
this
.
ScratchBlocks
.
defineBlocksWithJsonArray
(
blocksInfo
.
map
(
blockInfo
=>
blockInfo
.
json
));
this
.
ScratchBlocks
.
defineBlocksWithJsonArray
(
blocksInfo
.
map
(
blockInfo
=>
blockInfo
.
json
));
const
dynamicBlocksXML
=
this
.
props
.
vm
.
runtime
.
getBlocksXML
();
const
dynamicBlocksXML
=
this
.
props
.
vm
.
runtime
.
getBlocksXML
();
const
target
=
this
.
props
.
vm
.
editingTarget
;
const
target
=
this
.
props
.
vm
.
editingTarget
;
const
toolboxXML
=
makeToolboxXML
(
target
.
i
d
,
target
.
i
sStage
,
dynamicBlocksXML
);
const
toolboxXML
=
makeToolboxXML
(
target
.
i
sStage
,
target
.
i
d
,
dynamicBlocksXML
);
this
.
props
.
updateToolboxState
(
toolboxXML
);
this
.
props
.
updateToolboxState
(
toolboxXML
);
}
}
handleCategorySelected
(
categoryName
)
{
handleCategorySelected
(
categoryName
)
{
...
...
This diff is collapsed.
Click to expand it.
src/lib/make-toolbox-xml.js
+
14
−
14
View file @
7b9e22c6
...
@@ -2,7 +2,7 @@ const categorySeparator = '<sep gap="36"/>';
...
@@ -2,7 +2,7 @@ const categorySeparator = '<sep gap="36"/>';
const
blockSeparator
=
'
<sep gap="36"/>
'
;
// At default scale, about 28px
const
blockSeparator
=
'
<sep gap="36"/>
'
;
// At default scale, about 28px
const
motion
=
function
(
ta
r
ge
tId
,
isS
tage
)
{
const
motion
=
function
(
isS
tage
,
ta
r
ge
tId
)
{
return
`
return
`
<category name="Motion" colour="#4C97FF" secondaryColour="#3373CC">
<category name="Motion" colour="#4C97FF" secondaryColour="#3373CC">
${
isStage
?
`
${
isStage
?
`
...
@@ -132,7 +132,7 @@ const motion = function (targetId, isStage) {
...
@@ -132,7 +132,7 @@ const motion = function (targetId, isStage) {
`
;
`
;
};
};
const
looks
=
function
(
ta
r
ge
tId
,
isS
tage
)
{
const
looks
=
function
(
isS
tage
,
ta
r
ge
tId
)
{
return
`
return
`
<category name="Looks" colour="#9966FF" secondaryColour="#774DCB">
<category name="Looks" colour="#9966FF" secondaryColour="#774DCB">
${
isStage
?
''
:
`
${
isStage
?
''
:
`
...
@@ -346,7 +346,7 @@ const events = function () {
...
@@ -346,7 +346,7 @@ const events = function () {
`
;
`
;
};
};
const
control
=
function
(
_targetId
,
isStage
)
{
const
control
=
function
(
isStage
)
{
return
`
return
`
<category name="Control" colour="#FFAB19" secondaryColour="#CF8B17">
<category name="Control" colour="#FFAB19" secondaryColour="#CF8B17">
<block type="control_wait">
<block type="control_wait">
...
@@ -393,7 +393,7 @@ const control = function (_targetId, isStage) {
...
@@ -393,7 +393,7 @@ const control = function (_targetId, isStage) {
`
;
`
;
};
};
const
sensing
=
function
(
_targetId
,
isStage
)
{
const
sensing
=
function
(
isStage
)
{
return
`
return
`
<category name="Sensing" colour="#4CBFE6" secondaryColour="#2E8EB8">
<category name="Sensing" colour="#4CBFE6" secondaryColour="#2E8EB8">
${
isStage
?
''
:
`
${
isStage
?
''
:
`
...
@@ -658,24 +658,24 @@ const xmlOpen = '<xml style="display: none">';
...
@@ -658,24 +658,24 @@ const xmlOpen = '<xml style="display: none">';
const
xmlClose
=
'
</xml>
'
;
const
xmlClose
=
'
</xml>
'
;
/**
/**
* @param {!string} targetId - The current editing target
* @param {!boolean} isStage - Whether the toolbox is for a stage-type 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.
* @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.
* @returns {string} - a ScratchBlocks-style XML document for the contents of the toolbox.
*/
*/
const
makeToolboxXML
=
function
(
ta
r
ge
tId
,
isS
tage
,
categoriesXML
)
{
const
makeToolboxXML
=
function
(
isS
tage
,
ta
r
ge
tId
,
categoriesXML
)
{
const
gap
=
[
categorySeparator
];
const
gap
=
[
categorySeparator
];
const
everything
=
[
const
everything
=
[
xmlOpen
,
xmlOpen
,
motion
(
ta
r
ge
tId
,
isS
tage
),
gap
,
motion
(
isS
tage
,
ta
r
ge
tId
),
gap
,
looks
(
ta
r
ge
tId
,
isS
tage
),
gap
,
looks
(
isS
tage
,
ta
r
ge
tId
),
gap
,
sound
(
ta
r
ge
tId
,
isS
tage
),
gap
,
sound
(
isS
tage
,
ta
r
ge
tId
),
gap
,
events
(
ta
r
ge
tId
,
isS
tage
),
gap
,
events
(
isS
tage
,
ta
r
ge
tId
),
gap
,
control
(
ta
r
ge
tId
,
isS
tage
),
gap
,
control
(
isS
tage
,
ta
r
ge
tId
),
gap
,
sensing
(
ta
r
ge
tId
,
isS
tage
),
gap
,
sensing
(
isS
tage
,
ta
r
ge
tId
),
gap
,
operators
(
ta
r
ge
tId
,
isS
tage
),
gap
,
operators
(
isS
tage
,
ta
r
ge
tId
),
gap
,
data
(
ta
r
ge
tId
,
isS
tage
)
data
(
isS
tage
,
ta
r
ge
tId
)
];
];
if
(
categoriesXML
)
{
if
(
categoriesXML
)
{
...
...
This diff is collapsed.
Click to expand it.
src/reducers/toolbox.js
+
1
−
1
View file @
7b9e22c6
...
@@ -2,7 +2,7 @@ const UPDATE_TOOLBOX = 'scratch-gui/toolbox/UPDATE_TOOLBOX';
...
@@ -2,7 +2,7 @@ const UPDATE_TOOLBOX = 'scratch-gui/toolbox/UPDATE_TOOLBOX';
import
makeToolboxXML
from
'
../lib/make-toolbox-xml
'
;
import
makeToolboxXML
from
'
../lib/make-toolbox-xml
'
;
const
initialState
=
{
const
initialState
=
{
toolboxXML
:
makeToolboxXML
(
''
,
true
)
toolboxXML
:
makeToolboxXML
(
true
)
};
};
const
reducer
=
function
(
state
,
action
)
{
const
reducer
=
function
(
state
,
action
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment