Applying review comments

This commit is contained in:
grosbouddha 2015-09-20 02:12:59 +02:00
parent 90c2ed3470
commit 3f992cbb4a
3 changed files with 5 additions and 13 deletions

View File

@ -19,9 +19,9 @@
ns.ColorPicker.prototype.applyToolAt = function(col, row, frame, overlay, event) { ns.ColorPicker.prototype.applyToolAt = function(col, row, frame, overlay, event) {
if (frame.containsPixel(col, row)) { if (frame.containsPixel(col, row)) {
var sampledColor = frame.getPixel(col, row); var sampledColor = frame.getPixel(col, row);
if (event.button == Constants.LEFT_BUTTON) { if (pskl.app.mouseStateService.isLeftButtonPressed()) {
$.publish(Events.SELECT_PRIMARY_COLOR, [sampledColor]); $.publish(Events.SELECT_PRIMARY_COLOR, [sampledColor]);
} else if (event.button == Constants.RIGHT_BUTTON) { } else if (pskl.app.mouseStateService.isRightButtonPressed()) {
$.publish(Events.SELECT_SECONDARY_COLOR, [sampledColor]); $.publish(Events.SELECT_SECONDARY_COLOR, [sampledColor]);
} }
} }

View File

@ -69,16 +69,9 @@
color = window.tinycolor.lighten(pixelColor, step); color = window.tinycolor.lighten(pixelColor, step);
} }
} }
if (color) {
// Convert tinycolor color to string format.
color = color.toRgbString();
} else {
// Not sure why this check exists in the first place.
// Fallback to the always defined SimplePen tool color in this case.
color = this.getToolColor();
}
usedPixels[key] = true; usedPixels[key] = true;
return color; // Convert tinycolor color to string format.
return color.toRgbString();
}; };
})(); })();

View File

@ -10,7 +10,6 @@
ns.ShapeTool.call(this); ns.ShapeTool.call(this);
this.toolId = 'tool-rectangle'; this.toolId = 'tool-rectangle';
this.helpText = 'Rectangle tool'; this.helpText = 'Rectangle tool';
}; };
@ -23,7 +22,7 @@
var strokePoints = pskl.PixelUtils.getBoundRectanglePixels(this.startCol, this.startRow, col, row); var strokePoints = pskl.PixelUtils.getBoundRectanglePixels(this.startCol, this.startRow, col, row);
for (var i = 0 ; i < strokePoints.length ; i++) { for (var i = 0 ; i < strokePoints.length ; i++) {
// Change model: // Change model:
targetFrame.setPixel(strokePoints[i].col, strokePoints[i].row, this.getToolColor()); targetFrame.setPixel(strokePoints[i].col, strokePoints[i].row, color);
} }
}; };
})(); })();