Octave button handlers directly call octave changers

This commit is contained in:
Eric Rosenbaum 2018-11-05 16:53:29 -05:00
parent 0044907732
commit b688375b28

View file

@ -461,10 +461,13 @@ Blockly.FieldNote.prototype.showEditor_ = function() {
Blockly.FieldNote.OCTAVE_BUTTON_SIZE, false, svg);
this.octaveDownMouseDownWrapper_ =
Blockly.bindEvent_(this.octaveDownButton, 'mousedown', this, this.onOctaveDown_);
Blockly.bindEvent_(this.octaveDownButton, 'mousedown', this, function() {
this.changeOctaveBy_(-1);
});
this.octaveUpMouseDownWrapper_ =
Blockly.bindEvent_(this.octaveUpButton, 'mousedown', this, this.onOctaveUp_);
Blockly.bindEvent_(this.octaveUpButton, 'mousedown', this,function() {
this.changeOctaveBy_(1);
});
Blockly.DropDownDiv.setColour(this.sourceBlock_.parentBlock_.getColour(),
this.sourceBlock_.getColourTertiary());
Blockly.DropDownDiv.setCategory(this.sourceBlock_.parentBlock_.getCategory());
@ -697,22 +700,6 @@ Blockly.FieldNote.playNote_ = function(/* noteNum, id*/) {
return;
};
/**
* Handle the event when the octave down button is pressed.
* @private
*/
Blockly.FieldNote.prototype.onOctaveDown_ = function() {
this.changeOctaveBy_(-1);
};
/**
* Handle the event when the octave up button is pressed.
* @private
*/
Blockly.FieldNote.prototype.onOctaveUp_ = function() {
this.changeOctaveBy_(1);
};
/**
* Change the selected note by a number of octaves, and start the animation.
* @param {number} octaves The number of octaves to change by.