mirror of
https://github.com/google/blockly.git
synced 2026-01-06 08:30:13 +01:00
Prevent uncessary add/remove class calls on cursor during drag (#4885)
This commit is contained in:
@@ -217,9 +217,12 @@ Blockly.BlockDragger.prototype.dragBlock = function(e, currentDragDeltaXY) {
|
||||
}
|
||||
|
||||
this.draggedConnectionManager_.update(delta, this.dragTarget_);
|
||||
this.wouldDeleteBlock_ = this.draggedConnectionManager_.wouldDeleteBlock();
|
||||
|
||||
this.updateCursorDuringBlockDrag_();
|
||||
var wouldDeleteBlock = this.draggedConnectionManager_.wouldDeleteBlock();
|
||||
if (wouldDeleteBlock != this.wouldDeleteBlock_) {
|
||||
// Prevent unnecessary add/remove class calls.
|
||||
this.updateCursorDuringBlockDrag_();
|
||||
}
|
||||
this.wouldDeleteBlock_ = wouldDeleteBlock;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -140,9 +140,13 @@ Blockly.BubbleDragger.prototype.dragBubble = function(e, currentDragDeltaXY) {
|
||||
oldDragTarget && oldDragTarget.onDragExit();
|
||||
this.dragTarget_ && this.dragTarget_.onDragEnter();
|
||||
}
|
||||
this.wouldDeleteBubble_ = this.shouldDelete_(this.dragTarget_);
|
||||
|
||||
this.updateCursorDuringBubbleDrag_();
|
||||
var wouldDeleteBubble = this.shouldDelete_(this.dragTarget_);
|
||||
if (wouldDeleteBubble != this.wouldDeleteBubble_) {
|
||||
// Prevent unnecessary add/remove class calls.
|
||||
this.updateCursorDuringBubbleDrag_();
|
||||
}
|
||||
this.wouldDeleteBubble_ = wouldDeleteBubble;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -177,11 +181,7 @@ Blockly.BubbleDragger.prototype.shouldDelete_ = function(dragTarget) {
|
||||
* @private
|
||||
*/
|
||||
Blockly.BubbleDragger.prototype.updateCursorDuringBubbleDrag_ = function() {
|
||||
if (this.wouldDeleteBubble_) {
|
||||
this.draggingBubble_.setDeleteStyle(true);
|
||||
} else {
|
||||
this.draggingBubble_.setDeleteStyle(false);
|
||||
}
|
||||
this.draggingBubble_.setDeleteStyle(this.wouldDeleteBubble_);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user