mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Removed hack from ColorPicker class
This commit is contained in:
@@ -20,22 +20,10 @@
|
|||||||
ns.ColorPicker.prototype.applyToolAt = function(col, row, color, frame, overlay, event) {
|
ns.ColorPicker.prototype.applyToolAt = function(col, row, color, 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.ctrlKey) {
|
if (event.button == Constants.LEFT_BUTTON) {
|
||||||
pskl.app.piskelController.getPiskel().getLayers().forEach(function (l) {
|
$.publish(Events.SELECT_PRIMARY_COLOR, [sampledColor]);
|
||||||
l.getFrames().forEach(function (f) {
|
} else if (event.button == Constants.RIGHT_BUTTON) {
|
||||||
f.forEachPixel(function (pixelColor,x,y) {
|
$.publish(Events.SELECT_SECONDARY_COLOR, [sampledColor]);
|
||||||
if (pixelColor === sampledColor) {
|
|
||||||
f.setPixel(x, y, pskl.app.paletteController.getPrimaryColor());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (event.button == Constants.LEFT_BUTTON) {
|
|
||||||
$.publish(Events.SELECT_PRIMARY_COLOR, [sampledColor]);
|
|
||||||
} else if (event.button == Constants.RIGHT_BUTTON) {
|
|
||||||
$.publish(Events.SELECT_SECONDARY_COLOR, [sampledColor]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user