Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
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
appinventor-sources
Commits
e019f6a9
Commit
e019f6a9
authored
Apr 14, 2020
by
Beka Westberg
Committed by
Evan W. Patton
Apr 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix disabled blocks not working with backpack
parent
75b80b88
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
14 deletions
+15
-14
appinventor/blocklyeditor/src/backpack.js
appinventor/blocklyeditor/src/backpack.js
+2
-0
appinventor/blocklyeditor/src/backpackFlyout.js
appinventor/blocklyeditor/src/backpackFlyout.js
+7
-12
appinventor/blocklyeditor/src/workspace_svg.js
appinventor/blocklyeditor/src/workspace_svg.js
+5
-1
appinventor/lib/blockly
appinventor/lib/blockly
+1
-1
No files found.
appinventor/blocklyeditor/src/backpack.js
View file @
e019f6a9
...
@@ -53,6 +53,8 @@ Blockly.Backpack = function(targetWorkspace, opt_options) {
...
@@ -53,6 +53,8 @@ Blockly.Backpack = function(targetWorkspace, opt_options) {
}
else
{
}
else
{
opt_options
=
opt_options
||
{};
opt_options
=
opt_options
||
{};
this
.
options
=
new
Blockly
.
Options
(
opt_options
);
this
.
options
=
new
Blockly
.
Options
(
opt_options
);
// Parsing loses this option so we have to reassign.
this
.
options
.
disabledPatternId
=
opt_options
.
disabledPatternId
;
}
}
this
.
workspace_
=
targetWorkspace
;
this
.
workspace_
=
targetWorkspace
;
this
.
flyout_
=
new
Blockly
.
BackpackFlyout
(
this
.
options
);
this
.
flyout_
=
new
Blockly
.
BackpackFlyout
(
this
.
options
);
...
...
appinventor/blocklyeditor/src/backpackFlyout.js
View file @
e019f6a9
...
@@ -78,19 +78,14 @@ Blockly.BackpackFlyout.prototype.dispose = function() {
...
@@ -78,19 +78,14 @@ Blockly.BackpackFlyout.prototype.dispose = function() {
};
};
/**
/**
* Filter the blocks on the flyout to disable the ones that are above the
* Returns if the flyout allows a new instance of the given block to be created.
* capacity limit.
* Always returns true to allow disabled blocks to be dragged out.
* @param {!Blockly.BlockSvg} _block The block to copy from the flyout.
* @return {boolean} True if the flyout allows the block to be instantiated.
*/
*/
Blockly
.
BackpackFlyout
.
prototype
.
filterForCapacity_
=
function
()
{
Blockly
.
BackpackFlyout
.
prototype
.
isBlockCreatable_
=
function
(
_block
)
{
if
(
!
this
.
targetWorkspace_
)
return
;
return
true
;
var
remainingCapacity
=
this
.
targetWorkspace_
.
remainingCapacity
();
}
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
);
}
};
/**
/**
* Stop binding to the global mouseup and mousemove events.
* Stop binding to the global mouseup and mousemove events.
...
...
appinventor/blocklyeditor/src/workspace_svg.js
View file @
e019f6a9
...
@@ -230,7 +230,11 @@ Blockly.WorkspaceSvg.prototype.addWarningIndicator = function() {
...
@@ -230,7 +230,11 @@ Blockly.WorkspaceSvg.prototype.addWarningIndicator = function() {
*/
*/
Blockly
.
WorkspaceSvg
.
prototype
.
addBackpack
=
function
()
{
Blockly
.
WorkspaceSvg
.
prototype
.
addBackpack
=
function
()
{
if
(
Blockly
.
Backpack
&&
!
this
.
options
.
readOnly
)
{
if
(
Blockly
.
Backpack
&&
!
this
.
options
.
readOnly
)
{
this
.
backpack_
=
new
Blockly
.
Backpack
(
this
,
{
scrollbars
:
true
,
media
:
'
./assets/
'
});
this
.
backpack_
=
new
Blockly
.
Backpack
(
this
,
{
scrollbars
:
true
,
media
:
'
./assets/
'
,
disabledPatternId
:
this
.
options
.
disabledPatternId
,
});
var
svgBackpack
=
this
.
backpack_
.
createDom
(
this
);
var
svgBackpack
=
this
.
backpack_
.
createDom
(
this
);
this
.
svgGroup_
.
appendChild
(
svgBackpack
);
this
.
svgGroup_
.
appendChild
(
svgBackpack
);
this
.
backpack_
.
init
();
this
.
backpack_
.
init
();
...
...
blockly
@
db33ee12
Subproject commit d
db37e2ebf89deec0a4a43d0327c79c453ebf687
Subproject commit d
b33ee1262697977e9f2b3987f34651d0094f062
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