Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
383ca825
Commit
383ca825
authored
Dec 01, 2015
by
Neil Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix toolbar with both colours and subcategories.
Also fix updating of toolbar after loading Blockly.
parent
e5dfdf46
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
20 deletions
+28
-20
blockly_compressed.js
blockly_compressed.js
+14
-13
core/toolbox.js
core/toolbox.js
+13
-7
core/workspace_svg.js
core/workspace_svg.js
+1
-0
No files found.
blockly_compressed.js
View file @
383ca825
This diff is collapsed.
Click to expand it.
core/toolbox.js
View file @
383ca825
...
@@ -136,12 +136,9 @@ Blockly.Toolbox.prototype.init = function() {
...
@@ -136,12 +136,9 @@ Blockly.Toolbox.prototype.init = function() {
tree
.
setShowLines
(
false
);
tree
.
setShowLines
(
false
);
tree
.
setShowExpandIcons
(
false
);
tree
.
setShowExpandIcons
(
false
);
tree
.
setSelectedItem
(
null
);
tree
.
setSelectedItem
(
null
);
this
.
hasColours_
=
false
;
this
.
populate_
(
workspace
.
options
.
languageTree
);
this
.
populate_
(
workspace
.
options
.
languageTree
);
tree
.
render
(
this
.
HtmlDiv
);
tree
.
render
(
this
.
HtmlDiv
);
if
(
this
.
hasColours_
)
{
this
.
addColour_
();
this
.
addColour_
(
tree
);
}
this
.
position
();
this
.
position
();
};
};
...
@@ -224,12 +221,15 @@ Blockly.Toolbox.prototype.populate_ = function(newTree) {
...
@@ -224,12 +221,15 @@ Blockly.Toolbox.prototype.populate_ = function(newTree) {
rootOut
.
setSelectedItem
(
childOut
);
rootOut
.
setSelectedItem
(
childOut
);
}
}
childOut
.
setExpanded
(
true
);
childOut
.
setExpanded
(
true
);
}
else
{
childOut
.
setExpanded
(
false
);
}
}
break
;
break
;
case
'
SEP
'
:
case
'
SEP
'
:
treeOut
.
add
(
new
Blockly
.
Toolbox
.
TreeSeparator
());
treeOut
.
add
(
new
Blockly
.
Toolbox
.
TreeSeparator
());
break
;
break
;
case
'
BLOCK
'
:
case
'
BLOCK
'
:
case
'
SHADOW
'
:
treeOut
.
blocks
.
push
(
childIn
);
treeOut
.
blocks
.
push
(
childIn
);
break
;
break
;
}
}
...
@@ -248,15 +248,21 @@ Blockly.Toolbox.prototype.populate_ = function(newTree) {
...
@@ -248,15 +248,21 @@ Blockly.Toolbox.prototype.populate_ = function(newTree) {
/**
/**
* Recursively add colours to this toolbox.
* Recursively add colours to this toolbox.
* @param {!Blockly.Toolbox.TreeNode}
* @param {Blockly.Toolbox.TreeNode} opt_tree Starting point of tree.
* Defaults to the root node.
* @private
* @private
*/
*/
Blockly
.
Toolbox
.
prototype
.
addColour_
=
function
(
tree
)
{
Blockly
.
Toolbox
.
prototype
.
addColour_
=
function
(
opt_tree
)
{
var
tree
=
opt_tree
||
this
.
tree_
;
var
children
=
tree
.
getChildren
();
var
children
=
tree
.
getChildren
();
for
(
var
i
=
0
,
child
;
child
=
children
[
i
];
i
++
)
{
for
(
var
i
=
0
,
child
;
child
=
children
[
i
];
i
++
)
{
var
element
=
child
.
getRowElement
();
var
element
=
child
.
getRowElement
();
if
(
element
)
{
if
(
element
)
{
var
border
=
'
8px solid
'
+
(
child
.
hexColour
||
'
#ddd
'
);
if
(
this
.
hasColours_
)
{
var
border
=
'
8px solid
'
+
(
child
.
hexColour
||
'
#ddd
'
);
}
else
{
var
border
=
'
none
'
;
}
if
(
this
.
workspace_
.
RTL
)
{
if
(
this
.
workspace_
.
RTL
)
{
element
.
style
.
borderRight
=
border
;
element
.
style
.
borderRight
=
border
;
}
else
{
}
else
{
...
...
core/workspace_svg.js
View file @
383ca825
...
@@ -854,6 +854,7 @@ Blockly.WorkspaceSvg.prototype.updateToolbox = function(tree) {
...
@@ -854,6 +854,7 @@ Blockly.WorkspaceSvg.prototype.updateToolbox = function(tree) {
}
}
this
.
options
.
languageTree
=
tree
;
this
.
options
.
languageTree
=
tree
;
this
.
toolbox_
.
populate_
(
tree
);
this
.
toolbox_
.
populate_
(
tree
);
this
.
toolbox_
.
addColour_
();
}
else
{
}
else
{
if
(
!
this
.
flyout_
)
{
if
(
!
this
.
flyout_
)
{
throw
'
Existing toolbox has categories. Can
\'
t change mode.
'
;
throw
'
Existing toolbox has categories. Can
\'
t change mode.
'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment