diff --git a/src/js/drawingtools/selectiontools/BaseSelect.js b/src/js/drawingtools/selectiontools/BaseSelect.js index 896fac11..29bd9f85 100644 --- a/src/js/drawingtools/selectiontools/BaseSelect.js +++ b/src/js/drawingtools/selectiontools/BaseSelect.js @@ -76,18 +76,24 @@ */ ns.BaseSelect.prototype.moveUnactiveToolAt = function(col, row, color, frame, overlay, event) { if (overlay.containsPixel(col, row)) { - if(overlay.getPixel(col, row) != Constants.SELECTION_TRANSPARENT_COLOR) { + if(this.isInSelection(col, row)) { // We're hovering the selection, show the move tool: - this.BodyRoot.addClass(this.toolId); - this.BodyRoot.removeClass(this.secondaryToolId); - } else { - // We're not hovering the selection, show create selection tool: this.BodyRoot.addClass(this.secondaryToolId); this.BodyRoot.removeClass(this.toolId); + } else { + // We're not hovering the selection, show create selection tool: + this.BodyRoot.addClass(this.toolId); + this.BodyRoot.removeClass(this.secondaryToolId); } } }; + ns.BaseSelect.prototype.isInSelection = function (col, row) { + return this.selection && this.selection.pixels.some(function (pixel) { + return pixel.col === col && pixel.row === row; + }); + }; + ns.BaseSelect.prototype.hideHighlightedPixel = function() { // there is no highlighted pixel for selection tools, do nothing }; @@ -99,10 +105,20 @@ ns.BaseSelect.prototype.drawSelectionOnOverlay_ = function (overlay) { var pixels = this.selection.pixels; for(var i=0, l=pixels.length; i