diff --git a/Nibriboard/ClientFiles/BoardWindow.js b/Nibriboard/ClientFiles/BoardWindow.js index 850b063..8b5fa97 100644 --- a/Nibriboard/ClientFiles/BoardWindow.js +++ b/Nibriboard/ClientFiles/BoardWindow.js @@ -227,6 +227,13 @@ class BoardWindow extends EventEmitter if(this.displayGrid) this.renderGrid(canvas, context); + + context.save(); + context.translate( + -this.viewport.x, + -this.viewport.y + ); + // Only render the visible chunks if the chunk cache has been created // The chunk cache is only created once the ripple link connects successfully // to the nibriboard server. @@ -236,7 +243,9 @@ class BoardWindow extends EventEmitter this.renderOthers(canvas, context); // Render the currently active line if(typeof this.pencil !== "undefined") - this.pencil.render(this.viewport, canvas, context); + this.pencil.render(canvas, context); + + context.restore(); context.restore(); } diff --git a/Nibriboard/ClientFiles/ChunkCache.js b/Nibriboard/ClientFiles/ChunkCache.js index 017fa73..72b8d4e 100644 --- a/Nibriboard/ClientFiles/ChunkCache.js +++ b/Nibriboard/ClientFiles/ChunkCache.js @@ -54,14 +54,6 @@ class ChunkCache (Math.floor((visibleArea.y + (visibleArea.height / visibleArea.zoomLevel)) / chunkSize) * chunkSize) ); - /*context.translate( - -Math.abs(visibleArea.x - chunkArea.x), - -Math.abs(visibleArea.y - chunkArea.y) - );*/ - context.translate( - -visibleArea.x, - -visibleArea.y - ); for(let cx = chunkArea.x; cx <= chunkArea.x + chunkArea.width; cx += chunkSize) { diff --git a/Nibriboard/ClientFiles/Pencil.js b/Nibriboard/ClientFiles/Pencil.js index d42616e..cd47114 100644 --- a/Nibriboard/ClientFiles/Pencil.js +++ b/Nibriboard/ClientFiles/Pencil.js @@ -143,17 +143,12 @@ class Pencil * @param {HTMLCanvasElement} canvas The canvas to draw to. * @param {CanvasRenderingContext2D} context The rendering context to use to draw to the canvas. */ - render(visibleArea, canvas, context) { + render(canvas, context) { if(this.currentLineSegments.length == 0) return; context.save(); - context.translate( - -visibleArea.x, - -visibleArea.y - ); - context.beginPath(); context.moveTo(this.currentLineSegments[0].x, this.currentLineSegments[0].y); for(let i = 1; i < this.currentLineSegments.length; i++) {