mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user