cache delete areas instead of recalculating them onMouseDown

This commit is contained in:
Rachel Fenichel
2016-06-17 12:39:18 -07:00
parent 3ffd7a2d27
commit 8f601345bb
5 changed files with 15 additions and 1 deletions

View File

@@ -265,6 +265,10 @@ Blockly.Trashcan.prototype.position = function() {
* @return {goog.math.Rect} Rectangle in which to delete.
*/
Blockly.Trashcan.prototype.getClientRect = function() {
if (!this.svgGroup_) {
return null;
}
var trashRect = this.svgGroup_.getBoundingClientRect();
var left = trashRect.left + this.SPRITE_LEFT_ - this.MARGIN_HOTSPOT_;
var top = trashRect.top + this.SPRITE_TOP_ - this.MARGIN_HOTSPOT_;