mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Moved cursor in selection check to selection tool
This commit is contained in:
@ -59,7 +59,7 @@ class MoveSelectionTool extends DrawingTool {
|
||||
onStart(mousePos, mouseTarget) {
|
||||
super.onStart(mousePos, mouseTarget);
|
||||
|
||||
if (!this.cursorInSelectedArea(mousePos) &&
|
||||
if (!this.selectionTool.cursorInSelectedArea(mousePos) &&
|
||||
!Util.isChildOfByClass(mouseTarget, "editor-top-menu")) {
|
||||
this.endSelection();
|
||||
}
|
||||
@ -101,7 +101,7 @@ class MoveSelectionTool extends DrawingTool {
|
||||
onHover(mousePos) {
|
||||
super.onHover(mousePos);
|
||||
|
||||
if (this.cursorInSelectedArea(mousePos)) {
|
||||
if (this.selectionTool.cursorInSelectedArea(mousePos)) {
|
||||
currFile.canvasView.style.cursor = 'move';
|
||||
}
|
||||
else {
|
||||
@ -109,20 +109,6 @@ class MoveSelectionTool extends DrawingTool {
|
||||
}
|
||||
}
|
||||
|
||||
cursorInSelectedArea(cursorPos) {
|
||||
// Getting the coordinates relatively to the canvas
|
||||
let x = cursorPos[0] / currFile.zoom;
|
||||
let y = cursorPos[1] / currFile.zoom;
|
||||
|
||||
if (this.currSelection.left <= x && x <= this.currSelection.right) {
|
||||
if (y <= this.currSelection.bottom && y >= this.currSelection.top) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
endSelection() {
|
||||
if (this.currSelection == undefined)
|
||||
return;
|
||||
|
Reference in New Issue
Block a user