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
1026d353
Commit
1026d353
authored
Oct 21, 2015
by
Neil Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow blocks in toolbox to be disabled individually.
parent
a485e63d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
5 deletions
+12
-5
core/flyout.js
core/flyout.js
+8
-5
core/toolbox.js
core/toolbox.js
+1
-0
core/workspace_svg.js
core/workspace_svg.js
+1
-0
tests/playground.html
tests/playground.html
+2
-0
No files found.
core/flyout.js
View file @
1026d353
...
...
@@ -149,9 +149,11 @@ Blockly.Flyout.prototype.init = function(targetWorkspace) {
Array
.
prototype
.
push
.
apply
(
this
.
eventWrappers_
,
Blockly
.
bindEvent_
(
this
.
svgGroup_
,
'
wheel
'
,
this
,
this
.
wheel_
));
Array
.
prototype
.
push
.
apply
(
this
.
eventWrappers_
,
Blockly
.
bindEvent_
(
this
.
targetWorkspace_
.
getCanvas
(),
'
blocklyWorkspaceChange
'
,
this
,
this
.
filterForCapacity_
));
if
(
!
this
.
autoClose
)
{
Array
.
prototype
.
push
.
apply
(
this
.
eventWrappers_
,
Blockly
.
bindEvent_
(
this
.
targetWorkspace_
.
getCanvas
(),
'
blocklyWorkspaceChange
'
,
this
,
this
.
filterForCapacity_
));
}
// Dragging the flyout up and down.
Array
.
prototype
.
push
.
apply
(
this
.
eventWrappers_
,
Blockly
.
bindEvent_
(
this
.
svgGroup_
,
'
mousedown
'
,
this
,
this
.
onMouseDown_
));
...
...
@@ -676,8 +678,9 @@ Blockly.Flyout.prototype.filterForCapacity_ = function() {
var
blocks
=
this
.
workspace_
.
getTopBlocks
(
false
);
for
(
var
i
=
0
,
block
;
block
=
blocks
[
i
];
i
++
)
{
var
allBlocks
=
block
.
getDescendants
();
var
disabled
=
allBlocks
.
length
>
remainingCapacity
;
block
.
setDisabled
(
disabled
);
if
(
allBlocks
.
length
>
remainingCapacity
)
{
block
.
setDisabled
(
true
);
}
}
};
...
...
core/toolbox.js
View file @
1026d353
...
...
@@ -114,6 +114,7 @@ Blockly.Toolbox.prototype.init = function() {
}
});
var
workspaceOptions
=
{
disabledPatternId
:
workspace
.
options
.
disabledPatternId
,
parentWorkspace
:
workspace
,
RTL
:
workspace
.
RTL
,
svg
:
workspace
.
options
.
svg
...
...
core/workspace_svg.js
View file @
1026d353
...
...
@@ -264,6 +264,7 @@ Blockly.WorkspaceSvg.prototype.addZoomControls_ = function(bottom) {
*/
Blockly
.
WorkspaceSvg
.
prototype
.
addFlyout_
=
function
()
{
var
workspaceOptions
=
{
disabledPatternId
:
this
.
options
.
disabledPatternId
,
parentWorkspace
:
this
,
RTL
:
this
.
RTL
};
...
...
tests/playground.html
View file @
1026d353
...
...
@@ -73,6 +73,7 @@ function start() {
length
:
3
,
colour
:
'
#ccc
'
,
snap
:
true
},
maxBlocks
:
Infinity
,
media
:
'
../media/
'
,
readOnly
:
false
,
realtime
:
false
,
...
...
@@ -238,6 +239,7 @@ h1 {
</shadow>
</value>
</block>
<block
type=
"controls_repeat"
disabled=
"true"
></block>
<block
type=
"controls_whileUntil"
></block>
<block
type=
"controls_for"
>
<value
name=
"FROM"
>
...
...
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