mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-13 14:39:18 -04:00
Add red 'X' to mouse cursor if blocks are over toolbox.
This commit is contained in:
parent
3bc81bd543
commit
c9169285d9
6 changed files with 48 additions and 12 deletions
core
|
@ -32,6 +32,7 @@ goog.require('goog.html.SafeHtml');
|
|||
goog.require('goog.style');
|
||||
goog.require('goog.ui.tree.TreeControl');
|
||||
goog.require('goog.ui.tree.TreeNode');
|
||||
goog.require('goog.math.Rect');
|
||||
|
||||
|
||||
/**
|
||||
|
@ -197,6 +198,26 @@ Blockly.Toolbox.prototype.clearSelection = function() {
|
|||
this.tree_.setSelectedItem(null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the deletion rectangle for this toolbar.
|
||||
* @return {goog.math.Rect} Rectangle in which to delete.
|
||||
*/
|
||||
Blockly.Toolbox.prototype.getRect = function() {
|
||||
// BIG_NUM is offscreen padding so that blocks dragged beyond the toolbox
|
||||
// area are still deleted. Must be smaller than Infinity, but larger than
|
||||
// the largest screen size.
|
||||
var BIG_NUM = 10000000;
|
||||
// Assumes that the toolbox is on the SVG edge. If this changes
|
||||
// (e.g. toolboxes in mutators) then this code will need to be more complex.
|
||||
if (Blockly.RTL) {
|
||||
var svgSize = Blockly.svgSize();
|
||||
var x = svgSize.width - this.width;
|
||||
} else {
|
||||
var x = -BIG_NUM;
|
||||
}
|
||||
return new goog.math.Rect(x, -BIG_NUM, BIG_NUM + this.width, 2 * BIG_NUM);
|
||||
};
|
||||
|
||||
// Extending Closure's Tree UI.
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue