Fixed bug in canvas dragging (pan tool).

Signed-off-by: npalomba <nicola.palomba@studenti.galileilivorno.gov.it>
This commit is contained in:
npalomba 2019-03-31 18:48:15 +02:00
parent bd96d01970
commit 6a973192da

View File

@ -178,9 +178,9 @@ function draw (mouseEvent) {
} }
} }
else if (currentTool == 'pan' && dragging) { else if (currentTool == 'pan' && dragging) {
setCanvasOffset(layers[0].canvas, layers[0].canvas.offsetLeft + (cursorLocation[0] - lastPos[0]), layers[0].canvas.offsetTop + (cursorLocation[1] - lastPos[1]));
for (let i=0; i<layers.length; i++) { for (let i=1; i<layers.length; i++) {
setCanvasOffset(layers[i].canvas, layers[i].canvas.offsetLeft + (cursorLocation[0] - lastPos[0]), layers[i].canvas.offsetTop + (cursorLocation[1] - lastPos[1])) layers[i].copyData(layers[0]);
} }
} }
else if (currentTool == 'eyedropper' && dragging && mouseEvent.target == currentLayer.canvas) { else if (currentTool == 'eyedropper' && dragging && mouseEvent.target == currentLayer.canvas) {