Commit 43261ef0 authored by Neil Fraser's avatar Neil Fraser

Merge pull request #59 from orionhealth/bump-fix

Fix the logic block to bump the correct block.
parents 4db568a9 82f1ab11
...@@ -312,19 +312,18 @@ Blockly.Blocks['logic_compare'] = { ...@@ -312,19 +312,18 @@ Blockly.Blocks['logic_compare'] = {
} }
var blockA = this.getInputTargetBlock('A'); var blockA = this.getInputTargetBlock('A');
var blockB = this.getInputTargetBlock('B'); var blockB = this.getInputTargetBlock('B');
// Keep track of which block was added second // Kick blocks that existed prior to this change if they don't match
// (so the first block may be ejected upon mismatch). if (this.blocks_ && blockA && blockB &&
if (blockA && !blockB) { !blockA.outputConnection.checkType_(blockB.outputConnection)) {
this.blockAPriority_ = false; // Mismatch between two inputs. Disconnect previous and bump it away.
} else if (!blockA && blockB) { goog.array.forEach(this.blocks_, function(e) {
this.blockAPriority_ = true; if (e === blockA || e === blockB) {
} else if (blockA && blockB && e.setParent(null);
!blockA.outputConnection.checkType_(blockB.outputConnection)) { e.bumpNeighbours_();
// Mismatch between two inputs. Disconnect one and bump it away. }
var child = this.blockAPriority_ ? blockB : blockA; });
child.setParent(null);
child.bumpNeighbours_();
} }
this.blocks_ = [blockA, blockB];
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment