mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Only use "grabby" cursors when dragging (#498)
This commit is contained in:
parent
5bf6358ff7
commit
e8de0c46bf
2 changed files with 8 additions and 4 deletions
|
@ -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_();
|
||||
|
|
|
@ -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;',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue