Issue #772 - flash colorpicker cursor when using middle click or alt+click

This commit is contained in:
Julian Descottes 2018-04-08 17:41:04 +02:00
parent f462cd3b70
commit 0e5d74e1d8

View file

@ -345,6 +345,8 @@
// Picking color after ALT+click or middle mouse button click.
this.pickColorAt_(coords);
this.isPickingColor = false;
// Flash the cursor to briefly show the colorpicker cursor.
this.flashColorPicker_();
} else if (isMiddleDrag) {
// Stop the drag handler after a middle button drag action.
this.dragHandler.stopDrag();
@ -380,6 +382,16 @@
$.publish(evt, [color]);
};
ns.DrawingController.prototype.flashColorPicker_ = function () {
document.body.classList.add('tool-colorpicker');
document.body.classList.remove(this.currentToolBehavior.toolId);
window.clearTimeout(this.flashColorPickerTimer);
this.flashColorPickerTimer = window.setTimeout(function () {
document.body.classList.remove('tool-colorpicker');
document.body.classList.add(this.currentToolBehavior.toolId);
}.bind(this), 200);
};
/**
* Translate absolute x,y screen coordinates into sprite coordinates
* @param {Number} screenX