mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Migrate tools to BaseTool#getToolColor
This commit is contained in:
@@ -21,10 +21,10 @@
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ns.SimplePen.prototype.applyToolAt = function(col, row, color, frame, overlay, event) {
|
||||
ns.SimplePen.prototype.applyToolAt = function(col, row, color_legacy, frame, overlay, event) {
|
||||
this.previousCol = col;
|
||||
this.previousRow = row;
|
||||
|
||||
var color = this.getToolColor();
|
||||
overlay.setPixel(col, row, color);
|
||||
|
||||
if (color === Constants.TRANSPARENT_COLOR) {
|
||||
@@ -40,7 +40,7 @@
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ns.SimplePen.prototype.moveToolAt = function(col, row, color, frame, overlay, event) {
|
||||
ns.SimplePen.prototype.moveToolAt = function(col, row, color_legacy, frame, overlay, event) {
|
||||
if ((Math.abs(col - this.previousCol) > 1) || (Math.abs(row - this.previousRow) > 1)) {
|
||||
// The pen movement is too fast for the mousemove frequency, there is a gap between the
|
||||
// current point and the previously drawn one.
|
||||
@@ -48,24 +48,24 @@
|
||||
var interpolatedPixels = this.getLinePixels_(col, this.previousCol, row, this.previousRow);
|
||||
for (var i = 0, l = interpolatedPixels.length ; i < l ; i++) {
|
||||
var coords = interpolatedPixels[i];
|
||||
this.applyToolAt(coords.col, coords.row, color, frame, overlay, event);
|
||||
this.applyToolAt(coords.col, coords.row, color_legacy, frame, overlay, event);
|
||||
}
|
||||
} else {
|
||||
this.applyToolAt(col, row, color, frame, overlay, event);
|
||||
this.applyToolAt(col, row, color_legacy, frame, overlay, event);
|
||||
}
|
||||
|
||||
this.previousCol = col;
|
||||
this.previousRow = row;
|
||||
};
|
||||
|
||||
ns.SimplePen.prototype.releaseToolAt = function(col, row, color, frame, overlay, event) {
|
||||
ns.SimplePen.prototype.releaseToolAt = function(col, row, color_legacy, frame, overlay, event) {
|
||||
// apply on real frame
|
||||
this.setPixelsToFrame_(frame, this.pixels);
|
||||
|
||||
// save state
|
||||
this.raiseSaveStateEvent({
|
||||
pixels : this.pixels.slice(0),
|
||||
color : color
|
||||
color : this.getToolColor()
|
||||
});
|
||||
|
||||
// reset
|
||||
|
||||
Reference in New Issue
Block a user