Only use "grabby" cursors when dragging (#498)

This commit is contained in:
Tim Mickel 2016-07-07 15:53:50 -04:00 committed by GitHub
parent 5bf6358ff7
commit e8de0c46bf
2 changed files with 8 additions and 4 deletions

View file

@ -644,8 +644,6 @@ Blockly.BlockSvg.prototype.onMouseDown_ = function(e) {
Blockly.Events.setGroup(true);
}
// Left-click (or middle click)
Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED);
this.dragStartXY_ = this.getRelativeToSurfaceXY();
this.workspace.startDrag(e, this.dragStartXY_);
@ -953,6 +951,7 @@ Blockly.BlockSvg.prototype.onMouseMove_ = function(e) {
// Still dragging within the sticky DRAG_RADIUS.
var dr = goog.math.Coordinate.distance(oldXY, newXY) * this.workspace.scale;
if (dr > Blockly.DRAG_RADIUS) {
Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED);
// Switch to unrestricted dragging.
Blockly.dragMode_ = Blockly.DRAG_FREE;
Blockly.longStop_();

View file

@ -121,7 +121,13 @@ Blockly.Css.setCursor = function(cursor) {
return;
}
Blockly.Css.currentCursor_ = cursor;
var url = 'url(' + Blockly.Css.mediaPath_ + '/' + cursor + '.cur), auto';
var url;
if (cursor == Blockly.Css.Cursor.OPEN) {
// Scratch-specific: use CSS default cursor instead of "open hand."
url = 'default';
} else {
url = 'url(' + Blockly.Css.mediaPath_ + '/' + cursor + '.cur), auto';
}
// There are potentially hundreds of draggable objects. Changing their style
// properties individually is too slow, so change the CSS rule instead.
var rule = '.blocklyDraggable {\n cursor: ' + url + ';\n}\n';
@ -356,7 +362,6 @@ Blockly.Css.CONTENT = [
'}',
'.blocklyText {',
'cursor: default;',
'fill: #fff;',
'font-family: sans-serif;',
'font-size: 12pt;',