Fixed pan bug

Since setCanvasOffset is now a method of Layer, it can't be called like a global function.
This commit is contained in:
unsettledgames 2020-09-18 10:26:56 +02:00
parent b6d4544cd8
commit eedde51ad4
2 changed files with 1 additions and 2 deletions

View File

@ -40,7 +40,6 @@ Suggestions / Planned features:
- Polish:
- Show colors which would need to be added to palette
- Warning windows for wrong inputs
- Hide non-hovered layers
- Palette option remove unused colors
- Move selection with arrows
- Update pivot buttons when resizing canvas

View File

@ -259,7 +259,7 @@ function draw (mouseEvent) {
}
else if (currentTool.name == 'pan' && dragging) {
// Setting first layer position
setCanvasOffset(layers[0].canvas, layers[0].canvas.offsetLeft + (cursorLocation[0] - lastMouseClickPos[0]), layers[0].canvas.offsetTop + (cursorLocation[1] - lastMouseClickPos[1]));
layers[0].setCanvasOffset(layers[0].canvas.offsetLeft + (cursorLocation[0] - lastMouseClickPos[0]), layers[0].canvas.offsetTop + (cursorLocation[1] - lastMouseClickPos[1]));
// Copying that position to the other layers
for (let i=1; i<layers.length; i++) {
layers[i].copyData(layers[0]);