Skip to content

Commit

Permalink
Issue #772 - flash colorpicker cursor when using middle click or alt+…
Browse files Browse the repository at this point in the history
…click
  • Loading branch information
juliandescottes committed Apr 8, 2018
1 parent f462cd3 commit 0e5d74e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/js/controller/DrawingController.js
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0e5d74e

Please sign in to comment.