mirror of
https://github.com/google/blockly.git
synced 2026-01-25 17:50:10 +01:00
Fix warnings related to icons and bubbles (#3308)
* Fix warnings related to bubbles.
This commit is contained in:
@@ -328,7 +328,7 @@ Blockly.Bubble.prototype.isDeletable = function() {
|
||||
* @private
|
||||
*/
|
||||
Blockly.Bubble.prototype.resizeMouseDown_ = function(e) {
|
||||
this.promote_();
|
||||
this.promote();
|
||||
Blockly.Bubble.unbindDragEvents_();
|
||||
if (Blockly.utils.isRightButton(e)) {
|
||||
// No right-click.
|
||||
@@ -374,9 +374,9 @@ Blockly.Bubble.prototype.registerResizeEvent = function(callback) {
|
||||
/**
|
||||
* Move this bubble to the top of the stack.
|
||||
* @return {boolean} Whether or not the bubble has been moved.
|
||||
* @private
|
||||
* @package
|
||||
*/
|
||||
Blockly.Bubble.prototype.promote_ = function() {
|
||||
Blockly.Bubble.prototype.promote = function() {
|
||||
var svgGroup = this.bubbleGroup_.parentNode;
|
||||
if (svgGroup.lastChild !== this.bubbleGroup_) {
|
||||
svgGroup.appendChild(this.bubbleGroup_);
|
||||
|
||||
@@ -241,8 +241,9 @@ Blockly.Comment.prototype.createBubble_ = function() {
|
||||
Blockly.Comment.prototype.createEditableBubble_ = function() {
|
||||
this.bubble_ = new Blockly.Bubble(
|
||||
/** @type {!Blockly.WorkspaceSvg} */ (this.block_.workspace),
|
||||
this.createEditor_(), this.block_.svgPath_,
|
||||
this.iconXY_, this.model_.size.width, this.model_.size.height);
|
||||
this.createEditor_(), this.block_.pathObject.svgPath,
|
||||
/** @type {!Blockly.utils.Coordinate} */ (this.iconXY_),
|
||||
this.model_.size.width, this.model_.size.height);
|
||||
// Expose this comment's block's ID on its top-level SVG group.
|
||||
this.bubble_.setSvgId(this.block_.id);
|
||||
this.bubble_.registerResizeEvent(this.onBubbleResize_.bind(this));
|
||||
@@ -286,7 +287,7 @@ Blockly.Comment.prototype.disposeBubble_ = function() {
|
||||
* @private
|
||||
*/
|
||||
Blockly.Comment.prototype.startEdit_ = function(_e) {
|
||||
if (this.bubble_.promote_()) {
|
||||
if (this.bubble_.promote()) {
|
||||
// Since the act of moving this node within the DOM causes a loss of focus,
|
||||
// we need to reapply the focus.
|
||||
this.textarea_.focus();
|
||||
|
||||
@@ -174,8 +174,8 @@ Blockly.Icon.prototype.computeIconLocation = function() {
|
||||
|
||||
/**
|
||||
* Returns the center of the block's icon relative to the surface.
|
||||
* @return {!Blockly.utils.Coordinate} Object with x and y properties in workspace
|
||||
* coordinates.
|
||||
* @return {Blockly.utils.Coordinate} Object with x and y properties in
|
||||
* workspace coordinates.
|
||||
*/
|
||||
Blockly.Icon.prototype.getIconLocation = function() {
|
||||
return this.iconXY_;
|
||||
|
||||
@@ -257,7 +257,8 @@ Blockly.Mutator.prototype.setVisible = function(visible) {
|
||||
// Create the bubble.
|
||||
this.bubble_ = new Blockly.Bubble(
|
||||
/** @type {!Blockly.WorkspaceSvg} */ (this.block_.workspace),
|
||||
this.createEditor_(), this.block_.svgPath_, this.iconXY_, null, null);
|
||||
this.createEditor_(), this.block_.pathObject.svgPath,
|
||||
/** @type {!Blockly.utils.Coordinate} */ (this.iconXY_), null, null);
|
||||
// Expose this mutator's block's ID on its top-level SVG group.
|
||||
this.bubble_.setSvgId(this.block_.id);
|
||||
var tree = this.workspace_.options.languageTree;
|
||||
@@ -289,9 +290,12 @@ Blockly.Mutator.prototype.setVisible = function(visible) {
|
||||
// Save the initial connections, then listen for further changes.
|
||||
if (this.block_.saveConnections) {
|
||||
var thisMutator = this;
|
||||
this.block_.saveConnections(this.rootBlock_);
|
||||
var mutatorBlock =
|
||||
/** @type {{saveConnections: function(!Blockly.Block)}} */ (
|
||||
this.block_);
|
||||
mutatorBlock.saveConnections(this.rootBlock_);
|
||||
this.sourceListener_ = function() {
|
||||
thisMutator.block_.saveConnections(thisMutator.rootBlock_);
|
||||
mutatorBlock.saveConnections(thisMutator.rootBlock_);
|
||||
};
|
||||
this.block_.workspace.addChangeListener(this.sourceListener_);
|
||||
}
|
||||
|
||||
@@ -134,7 +134,8 @@ Blockly.Warning.prototype.createBubble = function() {
|
||||
this.paragraphElement_ = Blockly.Warning.textToDom_(this.getText());
|
||||
this.bubble_ = new Blockly.Bubble(
|
||||
/** @type {!Blockly.WorkspaceSvg} */ (this.block_.workspace),
|
||||
this.paragraphElement_, this.block_.svgPath_, this.iconXY_, null, null);
|
||||
this.paragraphElement_, this.block_.pathObject.svgPath,
|
||||
/** @type {!Blockly.utils.Coordinate} */ (this.iconXY_), null, null);
|
||||
// Expose this warning's block's ID on its top-level SVG group.
|
||||
this.bubble_.setSvgId(this.block_.id);
|
||||
if (this.block_.RTL) {
|
||||
@@ -171,7 +172,7 @@ Blockly.Warning.prototype.disposeBubble = function() {
|
||||
*/
|
||||
|
||||
Blockly.Warning.prototype.bodyFocus_ = function(_e) {
|
||||
this.bubble_.promote_();
|
||||
this.bubble_.promote();
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user