Skip to content

Commit

Permalink
Fixed #39
Browse files Browse the repository at this point in the history
  • Loading branch information
unsettledgames committed Dec 12, 2021
1 parent 62130ae commit 8433b60
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions js/tools/PanTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ class PanTool extends Tool {
Events.on('click', this.mainButton, switchFunction, this);
}

onStart(mousePos) {
onStart(mousePos, target) {
super.onStart(mousePos);
if (target.className != 'drawingCanvas')
return;
currFile.canvasView.style.cursor = "url(\'/pixel-editor/pan-held.png\'), auto";
}

onDrag(mousePos) {
onDrag(mousePos, target) {
super.onDrag(mousePos);
if (target.className != 'drawingCanvas')
return;

// Setting first layer position
currFile.layers[0].setCanvasOffset(currFile.layers[0].canvas.offsetLeft + (mousePos[0] - this.startMousePos[0]), currFile.layers[0].canvas.offsetTop + (mousePos[1] - this.startMousePos[1]));
Expand All @@ -22,8 +26,10 @@ class PanTool extends Tool {
}
}

onEnd(mousePos) {
onEnd(mousePos, target) {
super.onEnd(mousePos);
if (target.className != 'drawingCanvas')
return;

currFile.canvasView.style.cursor = "url(\'/pixel-editor/pan.png\'), auto";
}
Expand Down

0 comments on commit 8433b60

Please sign in to comment.