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

Get live line rendering working for *other* clients! Yay!

It _works_. It actually _works_! I'm so happy right now :D

It's taken 204 commits and 6 months to get to this point. Wow.
This commit is contained in:
Starbeamrainbowlabs 2017-07-09 15:28:12 +01:00
parent 59db921100
commit af8fe9bbc2
2 changed files with 6 additions and 3 deletions

View file

@ -3,6 +3,7 @@
window.EventEmitter = require("event-emitter-es6"); window.EventEmitter = require("event-emitter-es6");
import OtherClient from './OtherClient'; import OtherClient from './OtherClient';
import Vector from './Utilities/Vector';
class ClientManager extends EventEmitter class ClientManager extends EventEmitter
{ {
@ -10,8 +11,8 @@ class ClientManager extends EventEmitter
{ {
super(); super();
this.otherClientCursorSize = 25; this.otherClientCursorSize = 15;
this.otherClientCursorWidth = 2; this.otherClientCursorWidth = 4;
this.otherClients = new Map(); this.otherClients = new Map();

View file

@ -57,7 +57,7 @@ class OtherClient
context.lineTo(0, manager.otherClientCursorSize); context.lineTo(0, manager.otherClientCursorSize);
context.strokeStyle = this.Colour; context.strokeStyle = this.Colour;
context.lineWidth = manager.otherCursorWidth; context.lineWidth = manager.otherClientCursorWidth;
context.stroke(); context.stroke();
context.restore(); context.restore();
@ -79,6 +79,7 @@ class OtherClient
for(let point of linePoints) for(let point of linePoints)
context.lineTo(point.x, point.y); context.lineTo(point.x, point.y);
context.lineCap = "round";
context.strokeStyle = lineData.Colour; context.strokeStyle = lineData.Colour;
context.lineWidth = lineData.Width; context.lineWidth = lineData.Width;
context.stroke(); context.stroke();
@ -104,6 +105,7 @@ class OtherClient
if(typeof this.currentLines[lineData.LineId] != "undefined") if(typeof this.currentLines[lineData.LineId] != "undefined")
throw new Error(`Error: The line with the id ${lineData.LineId} already exists.`); throw new Error(`Error: The line with the id ${lineData.LineId} already exists.`);
lineData.Points = [];
this.currentLines[lineData.LineId] = lineData; this.currentLines[lineData.LineId] = lineData;
} }