This commit is contained in:
Rachel Fenichel
2016-05-24 15:35:38 -07:00
parent 763e9b938f
commit 8597c94a49
4 changed files with 34 additions and 29 deletions

View File

@@ -618,17 +618,19 @@ Blockly.Blocks['lists_getSublist'] = {
}
var menu = new Blockly.FieldDropdown(this['WHERE_OPTIONS_' + n],
function(value) {
var newAt = (value == 'FROM_START') || (value == 'FROM_END');
// The 'isAt' variable is available due to this function being a closure.
if (newAt != isAt) {
var block = this.sourceBlock_;
block.updateAt_(n, newAt);
// This menu has been destroyed and replaced. Update the replacement.
block.setFieldValue(value, 'WHERE' + n);
return null;
}
return undefined;
});
var newAt = (value == 'FROM_START') || (value == 'FROM_END');
// The 'isAt' variable is available due to this function being a
// closure.
if (newAt != isAt) {
var block = this.sourceBlock_;
block.updateAt_(n, newAt);
// This menu has been destroyed and replaced.
// Update the replacement.
block.setFieldValue(value, 'WHERE' + n);
return null;
}
return undefined;
});
this.getInput('AT' + n)
.appendField(menu, 'WHERE' + n);
if (n == 1) {

View File

@@ -271,21 +271,23 @@ Blockly.Blocks['logic_compare'] = {
* @this Blockly.Block
*/
init: function() {
var OPERATORS = this.RTL ? [
['=', 'EQ'],
['\u2260', 'NEQ'],
['>', 'LT'],
['\u2265', 'LTE'],
['<', 'GT'],
['\u2264', 'GTE']
] : [
['=', 'EQ'],
['\u2260', 'NEQ'],
['<', 'LT'],
['\u2264', 'LTE'],
['>', 'GT'],
['\u2265', 'GTE']
];
var rtlOperators = [
['=', 'EQ'],
['\u2260', 'NEQ'],
['>', 'LT'],
['\u2265', 'LTE'],
['<', 'GT'],
['\u2264', 'GTE']
];
var ltrOperators = [
['=', 'EQ'],
['\u2260', 'NEQ'],
['<', 'LT'],
['\u2264', 'LTE'],
['>', 'GT'],
['\u2265', 'GTE']
];
var OPERATORS = this.RTL ? rtlOperators : ltrOperators;
this.setHelpUrl(Blockly.Msg.LOGIC_COMPARE_HELPURL);
this.setColour(Blockly.Blocks.logic.HUE);
this.setOutput(true, 'Boolean');

View File

@@ -64,7 +64,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
* inconsistent as a result of the XML loading.
* @this Blockly.Block
*/
validate: function () {
validate: function() {
var name = Blockly.Procedures.findLegalName(
this.getFieldValue('NAME'), this);
this.setFieldValue(name, 'NAME');
@@ -126,7 +126,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
/**
* Create XML to represent the argument inputs.
* @param {=boolean} opt_paramIds If true include the IDs of the parameter
* quarks. Used by Blockly.Procedures.mutateCallers for reconnection.
* quarks. Used by Blockly.Procedures.mutateCallers for reconnection.
* @return {!Element} XML storage element.
* @this Blockly.Block
*/

View File

@@ -303,6 +303,7 @@ Blockly.BlockSvg.prototype.render = function(opt_bubble) {
*/
Blockly.BlockSvg.prototype.renderFields_ =
function(fieldList, cursorX, cursorY) {
/* eslint-disable indent */
cursorY += Blockly.BlockSvg.INLINE_PADDING_Y;
if (this.RTL) {
cursorX = -cursorX;
@@ -329,7 +330,7 @@ Blockly.BlockSvg.prototype.renderFields_ =
}
}
return this.RTL ? -cursorX : cursorX;
};
}; /* eslint-enable indent */
/**
* Computes the height and widths for each row and field.