1
0
Fork 0
mirror of https://github.com/sbrl/Nibriboard.git synced 2018-01-10 21:33:49 +00:00

[client] Tidy up translations

This commit is contained in:
Starbeamrainbowlabs 2017-06-12 20:46:50 +01:00
parent 636bc0535a
commit 74a0010e59
3 changed files with 11 additions and 15 deletions

View file

@ -227,6 +227,13 @@ class BoardWindow extends EventEmitter
if(this.displayGrid) if(this.displayGrid)
this.renderGrid(canvas, context); 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 // Only render the visible chunks if the chunk cache has been created
// The chunk cache is only created once the ripple link connects successfully // The chunk cache is only created once the ripple link connects successfully
// to the nibriboard server. // to the nibriboard server.
@ -236,7 +243,9 @@ class BoardWindow extends EventEmitter
this.renderOthers(canvas, context); this.renderOthers(canvas, context);
// Render the currently active line // Render the currently active line
if(typeof this.pencil !== "undefined") if(typeof this.pencil !== "undefined")
this.pencil.render(this.viewport, canvas, context); this.pencil.render(canvas, context);
context.restore();
context.restore(); context.restore();
} }

View file

@ -54,14 +54,6 @@ class ChunkCache
(Math.floor((visibleArea.y + (visibleArea.height / visibleArea.zoomLevel)) / chunkSize) * chunkSize) (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) for(let cx = chunkArea.x; cx <= chunkArea.x + chunkArea.width; cx += chunkSize)
{ {

View file

@ -143,17 +143,12 @@ class Pencil
* @param {HTMLCanvasElement} canvas The canvas to draw to. * @param {HTMLCanvasElement} canvas The canvas to draw to.
* @param {CanvasRenderingContext2D} context The rendering context to use to draw to the canvas. * @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) if(this.currentLineSegments.length == 0)
return; return;
context.save(); context.save();
context.translate(
-visibleArea.x,
-visibleArea.y
);
context.beginPath(); context.beginPath();
context.moveTo(this.currentLineSegments[0].x, this.currentLineSegments[0].y); context.moveTo(this.currentLineSegments[0].x, this.currentLineSegments[0].y);
for(let i = 1; i < this.currentLineSegments.length; i++) { for(let i = 1; i < this.currentLineSegments.length; i++) {