Fix #1487 and only add the delete cursor if the block is not deletabl… (#1491)

* Fix #1487 and only add the delete cursor if the block is not deletable. Also add a grab cursor when it is not deletable so the cursor keeps the grab hand when over the toolbox.  This changes the toolbox api slightly, but the methods it touches are @package so it should be okay.
This commit is contained in:
picklesrus
2017-12-04 10:36:47 -08:00
committed by GitHub
parent a6603b462a
commit d1886572d0
3 changed files with 20 additions and 8 deletions

View File

@@ -168,7 +168,9 @@ Blockly.BlockDragger.prototype.startBlockDrag = function(currentDragDeltaXY) {
this.draggingBlock_.moveToDragSurface_();
if (this.workspace_.toolbox_) {
this.workspace_.toolbox_.addDeleteStyle();
var style = this.draggingBlock_.isDeletable() ? 'blocklyToolboxDelete' :
'blocklyToolboxGrab';
this.workspace_.toolbox_.addStyle(style);
}
};
@@ -224,7 +226,9 @@ Blockly.BlockDragger.prototype.endBlockDrag = function(e, currentDragDeltaXY) {
this.workspace_.setResizesEnabled(true);
if (this.workspace_.toolbox_) {
this.workspace_.toolbox_.removeDeleteStyle();
var style = this.draggingBlock_.isDeletable() ? 'blocklyToolboxDelete' :
'blocklyToolboxGrab';
this.workspace_.toolbox_.removeStyle(style);
}
Blockly.Events.setGroup(false);
};