Skip to content

Commit

Permalink
Disallow drawing on header. (mozilla-services#4170)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenba committed Mar 2, 2018
1 parent 8907447 commit eda69b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/src/pages/shot/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ exports.Editor = class Editor extends React.Component {
this.pos.x = e.clientX - rect.left,
this.pos.y = e.clientY - rect.top
drawMousedown = true;
if (this.isClickOnPicker(e)) {
if (this.isOnUndrawableArea(e)) {
drawMousedown = false;
}
this.draw(e);
Expand All @@ -593,9 +593,9 @@ exports.Editor = class Editor extends React.Component {
}
}

isClickOnPicker(e) {
const targetClass = e.target.className;
return (targetClass === "swatch" || targetClass === "color-board" || targetClass === "color-row");
isOnUndrawableArea(e) {
const header = document.querySelector(".editor-header");
return (header.contains(e.target) || header === e.target);
}

drawPen(e) {
Expand Down

0 comments on commit eda69b6

Please sign in to comment.