Added correct cursor to move tool

Added _move.js to handle the selection movement, added cursor managemente for that tool. Found a bug in the imagedata part, it is currently blank.
This commit is contained in:
unsettledgames
2020-03-05 13:34:29 +01:00
parent 7ec24fc046
commit b81e3f36a9
4 changed files with 71 additions and 9 deletions

View File

@@ -1,6 +1,9 @@
var currentMouseEvent;
//mousedown - start drawing
window.addEventListener("mousedown", function (mouseEvent) {
// Saving the event in case something else needs it
currentMouseEvent = mouseEvent;
//if no document has been created yet, or this is a dialog open
if (!documentCreated || dialogueOpen) return;
@@ -44,7 +47,9 @@ window.addEventListener("mousedown", function (mouseEvent) {
//mouseup - end drawing
window.addEventListener("mouseup", function (mouseEvent) {
// Saving the event in case something else needs it
currentMouseEvent = mouseEvent;
closeMenu();
if (!documentCreated || dialogueOpen) return;
@@ -125,6 +130,9 @@ window.addEventListener("mouseup", function (mouseEvent) {
//mouse is moving on canvas
window.addEventListener("mousemove", draw, false);
function draw (mouseEvent) {
// Saving the event in case something else needs it
currentMouseEvent = mouseEvent;
var cursorLocation = getCursorPosition(mouseEvent);
//if a document hasnt yet been created, exit this function
@@ -247,6 +255,11 @@ function draw (mouseEvent) {
updateRectSelection(mouseEvent);
}
}
else if (currentTool == 'moveselection') {
console.log("Aggiorno il cursore");
updateCursor();
updateMovePreview();
}
}
//mousewheel scrroll