mirror of
https://github.com/google/blockly.git
synced 2026-01-12 11:27:14 +01:00
Even more lint. 90 errors remaining.
This commit is contained in:
@@ -181,7 +181,7 @@ Blockly.FieldDropdown.prototype.addTouchStartListener_ = function(menu) {
|
||||
control.handleMouseDown(e);
|
||||
}
|
||||
menu.getHandler().listen(menu.getElement(), goog.events.EventType.TOUCHSTART,
|
||||
callback);
|
||||
callback);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -197,7 +197,7 @@ Blockly.FieldDropdown.prototype.addTouchEndListener_ = function(menu) {
|
||||
control.performActionInternal(e);
|
||||
}
|
||||
menu.getHandler().listen(menu.getElement(), goog.events.EventType.TOUCHEND,
|
||||
callbackTouchEnd);
|
||||
callbackTouchEnd);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -485,11 +485,13 @@ Blockly.FieldDropdown.prototype.render_ = function() {
|
||||
Blockly.FieldDropdown.prototype.renderSelectedImage_ = function() {
|
||||
// Image option is selected.
|
||||
this.imageElement_ = Blockly.utils.createSvgElement('image',
|
||||
{'y': 5,
|
||||
'height': this.imageJson_.height + 'px',
|
||||
'width': this.imageJson_.width + 'px'}, this.fieldGroup_);
|
||||
{
|
||||
'y': 5,
|
||||
'height': this.imageJson_.height + 'px',
|
||||
'width': this.imageJson_.width + 'px'
|
||||
}, this.fieldGroup_);
|
||||
this.imageElement_.setAttributeNS('http://www.w3.org/1999/xlink',
|
||||
'xlink:href', this.imageJson_.src);
|
||||
'xlink:href', this.imageJson_.src);
|
||||
// Insert dropdown arrow.
|
||||
this.textElement_.appendChild(this.arrow_);
|
||||
var arrowWidth = Blockly.Field.getCachedWidth(this.arrow_);
|
||||
|
||||
@@ -81,12 +81,12 @@ Blockly.FieldImage.prototype.init = function() {
|
||||
}
|
||||
/** @type {SVGElement} */
|
||||
this.imageElement_ = Blockly.utils.createSvgElement(
|
||||
'image',
|
||||
{
|
||||
'height': this.height_ + 'px',
|
||||
'width': this.width_ + 'px'
|
||||
},
|
||||
this.fieldGroup_);
|
||||
'image',
|
||||
{
|
||||
'height': this.height_ + 'px',
|
||||
'width': this.width_ + 'px'
|
||||
},
|
||||
this.fieldGroup_);
|
||||
this.setValue(this.src_);
|
||||
this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_);
|
||||
|
||||
@@ -115,7 +115,7 @@ Blockly.FieldImage.prototype.maybeAddClickHandler_ = function() {
|
||||
if (this.clickHandler_) {
|
||||
this.mouseDownWrapper_ =
|
||||
Blockly.bindEventWithChecks_(this.fieldGroup_, 'mousedown', this,
|
||||
this.onMouseDown_);
|
||||
this.onMouseDown_);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -187,7 +187,7 @@ Blockly.FieldImage.prototype.forceRerender = function() {
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldImage.prototype.updateWidth = function() {
|
||||
// NOP
|
||||
// NOP
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -156,12 +156,12 @@ Blockly.FieldTextInput.prototype.showEditor_ = function(opt_quietInput) {
|
||||
Blockly.FieldTextInput.prototype.showPromptEditor_ = function() {
|
||||
var fieldText = this;
|
||||
Blockly.prompt(Blockly.Msg.CHANGE_VALUE_TITLE, this.text_,
|
||||
function(newValue) {
|
||||
if (fieldText.sourceBlock_) {
|
||||
newValue = fieldText.callValidator(newValue);
|
||||
}
|
||||
fieldText.setValue(newValue);
|
||||
});
|
||||
function(newValue) {
|
||||
if (fieldText.sourceBlock_) {
|
||||
newValue = fieldText.callValidator(newValue);
|
||||
}
|
||||
fieldText.setValue(newValue);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -207,15 +207,15 @@ Blockly.FieldTextInput.prototype.bindEvents_ = function(htmlInput) {
|
||||
// Bind to keydown -- trap Enter without IME and Esc to hide.
|
||||
htmlInput.onKeyDownWrapper_ =
|
||||
Blockly.bindEventWithChecks_(htmlInput, 'keydown', this,
|
||||
this.onHtmlInputKeyDown_);
|
||||
this.onHtmlInputKeyDown_);
|
||||
// Bind to keyup -- trap Enter; resize after every keystroke.
|
||||
htmlInput.onKeyUpWrapper_ =
|
||||
Blockly.bindEventWithChecks_(htmlInput, 'keyup', this,
|
||||
this.onHtmlInputChange_);
|
||||
this.onHtmlInputChange_);
|
||||
// Bind to keyPress -- repeatedly resize when holding down a key.
|
||||
htmlInput.onKeyPressWrapper_ =
|
||||
Blockly.bindEventWithChecks_(htmlInput, 'keypress', this,
|
||||
this.onHtmlInputChange_);
|
||||
this.onHtmlInputChange_);
|
||||
htmlInput.onWorkspaceChangeWrapper_ = this.resizeEditor_.bind(this);
|
||||
this.workspace_.addChangeListener(htmlInput.onWorkspaceChangeWrapper_);
|
||||
};
|
||||
|
||||
@@ -301,8 +301,12 @@ Blockly.FieldVariable.dropdownCreate = function() {
|
||||
}
|
||||
options.push([Blockly.Msg.RENAME_VARIABLE, Blockly.RENAME_VARIABLE_ID]);
|
||||
if (Blockly.Msg.DELETE_VARIABLE) {
|
||||
options.push([Blockly.Msg.DELETE_VARIABLE.replace('%1', name),
|
||||
Blockly.DELETE_VARIABLE_ID]);
|
||||
options.push(
|
||||
[
|
||||
Blockly.Msg.DELETE_VARIABLE.replace('%1', name),
|
||||
Blockly.DELETE_VARIABLE_ID
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return options;
|
||||
|
||||
@@ -242,7 +242,7 @@ Blockly.Flyout.prototype.init = function(targetWorkspace) {
|
||||
// Dragging the flyout up and down.
|
||||
Array.prototype.push.apply(this.eventWrappers_,
|
||||
Blockly.bindEventWithChecks_(this.svgBackground_, 'mousedown', this,
|
||||
this.onMouseDown_));
|
||||
this.onMouseDown_));
|
||||
|
||||
// A flyout connected to a workspace doesn't have its own current gesture.
|
||||
this.workspace_.getGesture =
|
||||
@@ -315,7 +315,7 @@ Blockly.Flyout.prototype.isVisible = function() {
|
||||
return this.isVisible_;
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set whether the flyout is visible. A value of true does not necessarily mean
|
||||
* that the flyout is shown. It could be hidden because its container is hidden.
|
||||
* @param {boolean} visible True if visible.
|
||||
@@ -637,7 +637,7 @@ Blockly.Flyout.prototype.initFlyoutButton_ = function(button, x, y) {
|
||||
// Clicking on a flyout button or label is a lot like clicking on the
|
||||
// flyout background.
|
||||
this.listeners_.push(Blockly.bindEventWithChecks_(buttonSvg, 'mousedown',
|
||||
this, this.onMouseDown_));
|
||||
this, this.onMouseDown_));
|
||||
|
||||
this.buttons_.push(button);
|
||||
};
|
||||
@@ -659,13 +659,13 @@ Blockly.Flyout.prototype.createRect_ = function(block, x, y, blockHW, index) {
|
||||
// Create an invisible rectangle under the block to act as a button. Just
|
||||
// using the block as a button is poor, since blocks have holes in them.
|
||||
var rect = Blockly.utils.createSvgElement('rect',
|
||||
{
|
||||
'fill-opacity': 0,
|
||||
'x': x,
|
||||
'y': y,
|
||||
'height': blockHW.height,
|
||||
'width': blockHW.width
|
||||
}, null);
|
||||
{
|
||||
'fill-opacity': 0,
|
||||
'x': x,
|
||||
'y': y,
|
||||
'height': blockHW.height,
|
||||
'width': blockHW.width
|
||||
}, null);
|
||||
rect.tooltip = block;
|
||||
Blockly.Tooltip.bindMouseEvents(rect);
|
||||
// Add the rectangles under the blocks, so that the blocks' tooltips work.
|
||||
|
||||
@@ -138,20 +138,28 @@ Blockly.FlyoutButton.prototype.createDom = function() {
|
||||
if (!this.isLabel_) {
|
||||
// Shadow rectangle (light source does not mirror in RTL).
|
||||
var shadow = Blockly.utils.createSvgElement('rect',
|
||||
{'class': 'blocklyFlyoutButtonShadow',
|
||||
'rx': 4, 'ry': 4, 'x': 1, 'y': 1},
|
||||
this.svgGroup_);
|
||||
{
|
||||
'class': 'blocklyFlyoutButtonShadow',
|
||||
'rx': 4, 'ry': 4, 'x': 1, 'y': 1
|
||||
},
|
||||
this.svgGroup_);
|
||||
}
|
||||
// Background rectangle.
|
||||
var rect = Blockly.utils.createSvgElement('rect',
|
||||
{'class': this.isLabel_ ?
|
||||
'blocklyFlyoutLabelBackground' : 'blocklyFlyoutButtonBackground',
|
||||
'rx': 4, 'ry': 4},
|
||||
{
|
||||
'class': this.isLabel_ ?
|
||||
'blocklyFlyoutLabelBackground' : 'blocklyFlyoutButtonBackground',
|
||||
'rx': 4, 'ry': 4
|
||||
},
|
||||
this.svgGroup_);
|
||||
|
||||
var svgText = Blockly.utils.createSvgElement('text',
|
||||
{'class': this.isLabel_ ? 'blocklyFlyoutLabelText' : 'blocklyText',
|
||||
'x': 0, 'y': 0, 'text-anchor': 'middle'},
|
||||
{
|
||||
'class': this.isLabel_ ? 'blocklyFlyoutLabelText' : 'blocklyText',
|
||||
'x': 0,
|
||||
'y': 0,
|
||||
'text-anchor': 'middle'
|
||||
},
|
||||
this.svgGroup_);
|
||||
svgText.textContent = this.text_;
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ Blockly.HorizontalFlyout.prototype.setBackgroundPath_ = function(width,
|
||||
path.push('a', this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1,
|
||||
this.CORNER_RADIUS, -this.CORNER_RADIUS);
|
||||
path.push('h', width);
|
||||
// Right.
|
||||
// Right.
|
||||
path.push('a', this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1,
|
||||
this.CORNER_RADIUS, this.CORNER_RADIUS);
|
||||
path.push('v', height);
|
||||
|
||||
Reference in New Issue
Block a user