mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Fix dithering right-click color inversion on FF/IE
Record pressed mouse button type only at mousedown time. On IE/FF, the button type is not available during mousemove. Did a round of testing on both FF and Chrome.
This commit is contained in:
parent
d0acb625cf
commit
7d964c7fde
@ -17,12 +17,17 @@
|
||||
* @override
|
||||
*/
|
||||
ns.DitheringTool.prototype.applyToolAt = function(col, row, color, frame, overlay, event) {
|
||||
// On Firefox/IE, the clicked button type is not part of the mousemove event.
|
||||
// Ensure we record the pressed button on the initial mousedown only.
|
||||
if (event.type == 'mousedown') {
|
||||
this.invertColors_ = event.button === Constants.RIGHT_BUTTON;
|
||||
}
|
||||
|
||||
// Use primary selected color on cell with either an odd col or row.
|
||||
// Use secondary color otherwise.
|
||||
// When using the right mouse button, invert the above behavior to allow quick corrections.
|
||||
var usePrimaryColor = (col + row) % 2;
|
||||
var invertColors = event.button === Constants.RIGHT_BUTTON;
|
||||
usePrimaryColor = invertColors ? !usePrimaryColor : usePrimaryColor;
|
||||
usePrimaryColor = this.invertColors_ ? !usePrimaryColor : usePrimaryColor;
|
||||
|
||||
var selectedColors = pskl.app.selectedColorsService.getColors();
|
||||
var ditheringColor = usePrimaryColor ? selectedColors[0] : selectedColors[1];
|
||||
|
Loading…
Reference in New Issue
Block a user