mirror of
https://github.com/google/blockly.git
synced 2026-01-10 10:27:08 +01:00
Update mutator workspace delete areas when bubble is moved. (#3355)
* Update mutator workspace delete areas when its moved
This commit is contained in:
@@ -81,6 +81,20 @@ Blockly.Bubble = function(workspace, content, shape, anchorXY,
|
||||
this.resizeGroup_, 'mousedown', this, this.resizeMouseDown_);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to call on resize of bubble.
|
||||
* @type {?function()}
|
||||
* @private
|
||||
*/
|
||||
this.resizeCallback_ = null;
|
||||
|
||||
/**
|
||||
* Method to call on move of bubble.
|
||||
* @type {?function()}
|
||||
* @private
|
||||
*/
|
||||
this.moveCallback_ = null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -123,13 +137,6 @@ Blockly.Bubble.onMouseUpWrapper_ = null;
|
||||
*/
|
||||
Blockly.Bubble.onMouseMoveWrapper_ = null;
|
||||
|
||||
/**
|
||||
* Function to call on resize of bubble.
|
||||
* @type {Function}
|
||||
* @private
|
||||
*/
|
||||
Blockly.Bubble.prototype.resizeCallback_ = null;
|
||||
|
||||
/**
|
||||
* Stop binding to the global mouseup and mousemove events.
|
||||
* @private
|
||||
@@ -371,6 +378,14 @@ Blockly.Bubble.prototype.registerResizeEvent = function(callback) {
|
||||
this.resizeCallback_ = callback;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a function as a callback event for when the bubble is moved.
|
||||
* @param {!Function} callback The function to call on move.
|
||||
*/
|
||||
Blockly.Bubble.prototype.registerMoveEvent = function(callback) {
|
||||
this.moveCallback_ = callback;
|
||||
};
|
||||
|
||||
/**
|
||||
* Move this bubble to the top of the stack.
|
||||
* @return {boolean} Whether or not the bubble has been moved.
|
||||
@@ -620,6 +635,17 @@ Blockly.Bubble.prototype.moveTo = function(x, y) {
|
||||
this.bubbleGroup_.setAttribute('transform', 'translate(' + x + ',' + y + ')');
|
||||
};
|
||||
|
||||
/**
|
||||
* Triggers a move callback if one exists at the end of a drag.
|
||||
* @param {boolean} adding True if adding, false if removing.
|
||||
* @package
|
||||
*/
|
||||
Blockly.Bubble.prototype.setDragging = function(adding) {
|
||||
if (!adding && this.moveCallback_) {
|
||||
this.moveCallback_();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the dimensions of this bubble.
|
||||
* @return {!Blockly.utils.Size} The height and width of the bubble.
|
||||
|
||||
Reference in New Issue
Block a user