Added back eyedropper alt key binding

This commit is contained in:
unsettledgames
2021-11-09 12:53:19 +01:00
parent 2ca5aa75b4
commit 73f7c980eb
4 changed files with 70 additions and 14 deletions

View File

@ -39,7 +39,7 @@ class Tool {
switch (this.cursorType.type) {
case 'html':
canvasView.style.cursor = 'default';
canvasView.style.cursor = 'none';
break;
case 'cursor':
this.cursor = this.cursorType.style;
@ -50,7 +50,11 @@ class Tool {
}
}
updateCursor() {}
updateCursor() {
brushPreview.style.display = 'block';
brushPreview.style.width = this.currSize * zoom + 'px';
brushPreview.style.height = this.currSize * zoom + 'px';
}
onMouseWheel(mousePos, mode) {}
@ -58,6 +62,8 @@ class Tool {
this.prevMousePos = this.currMousePos;
this.currMousePos = cursorLocation;
this.updateCursor();
let toSub = 1;
// Prevents the brush to be put in the middle of pixels
if (this.currSize % 2 == 0) {
@ -68,16 +74,14 @@ class Tool {
brushPreview.style.top = (Math.floor(cursorLocation[1] / zoom) * zoom + currentLayer.canvas.offsetTop - this.currSize * zoom / 2 - zoom / 2 + toSub * zoom) + 'px';
if (this.cursorType.type == 'html') {
if (cursorTarget == 'drawingCanvas'|| cursorTarget.className == 'drawingCanvas') {
if (cursorTarget.className == 'drawingCanvas'|| cursorTarget.className == 'drawingCanvas') {
brushPreview.style.visibility = 'visible';
canvasView.style.cursor = 'none';
}
else {
brushPreview.style.visibility = 'hidden';
canvasView.style.cursor = 'default';
}
brushPreview.style.display = 'block';
brushPreview.style.width = this.currSize * zoom + 'px';
brushPreview.style.height = this.currSize * zoom + 'px';
}
}
@ -85,7 +89,9 @@ class Tool {
if (this.mainButton != undefined)
this.mainButton.parentElement.classList.remove("selected");
this.isSelected = false;
brushPreview.style.visibility = 'hidden';
canvasView.style.cursor = 'default';
}
onStart(mousePos) {