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
43261ef0
Commit
43261ef0
authored
Feb 02, 2015
by
Neil Fraser
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #59 from orionhealth/bump-fix
Fix the logic block to bump the correct block.
parents
4db568a9
82f1ab11
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
blocks/logic.js
blocks/logic.js
+11
-12
No files found.
blocks/logic.js
View file @
43261ef0
...
...
@@ -312,19 +312,18 @@ Blockly.Blocks['logic_compare'] = {
}
var
blockA
=
this
.
getInputTargetBlock
(
'
A
'
);
var
blockB
=
this
.
getInputTargetBlock
(
'
B
'
);
// Keep track of which block was added second
// (so the first block may be ejected upon mismatch).
if
(
blockA
&&
!
blockB
)
{
this
.
blockAPriority_
=
false
;
}
else
if
(
!
blockA
&&
blockB
)
{
this
.
blockAPriority_
=
true
;
}
else
if
(
blockA
&&
blockB
&&
// Kick blocks that existed prior to this change if they don't match
if
(
this
.
blocks_
&&
blockA
&&
blockB
&&
!
blockA
.
outputConnection
.
checkType_
(
blockB
.
outputConnection
))
{
// Mismatch between two inputs. Disconnect one and bump it away.
var
child
=
this
.
blockAPriority_
?
blockB
:
blockA
;
child
.
setParent
(
null
);
child
.
bumpNeighbours_
();
// Mismatch between two inputs. Disconnect previous and bump it away.
goog
.
array
.
forEach
(
this
.
blocks_
,
function
(
e
)
{
if
(
e
===
blockA
||
e
===
blockB
)
{
e
.
setParent
(
null
);
e
.
bumpNeighbours_
();
}
});
}
this
.
blocks_
=
[
blockA
,
blockB
];
}
};
...
...
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