mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Applying review comments
This commit is contained in:
parent
90c2ed3470
commit
3f992cbb4a
@ -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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user