mirror of
https://github.com/sbrl/Nibriboard.git
synced 2018-01-10 21:33:49 +00:00
[client] Add better background to sidebar and create Interface class
This commit is contained in:
parent
5b75eff4eb
commit
e1f2b2910a
6 changed files with 27 additions and 8 deletions
|
@ -12,6 +12,7 @@ import OtherClient from './OtherClient';
|
||||||
import Pencil from './Pencil';
|
import Pencil from './Pencil';
|
||||||
import { get } from './Utilities';
|
import { get } from './Utilities';
|
||||||
import Keyboard from './Utilities/Keyboard';
|
import Keyboard from './Utilities/Keyboard';
|
||||||
|
import Interface from './Interface';
|
||||||
|
|
||||||
class BoardWindow extends EventEmitter
|
class BoardWindow extends EventEmitter
|
||||||
{
|
{
|
||||||
|
@ -79,8 +80,8 @@ class BoardWindow extends EventEmitter
|
||||||
this.canvas = canvas;
|
this.canvas = canvas;
|
||||||
this.context = canvas.getContext("2d");
|
this.context = canvas.getContext("2d");
|
||||||
|
|
||||||
// Grab a reference to the sidebar
|
// Grab a reference to the sidebar and wrap it in an Interface class instance
|
||||||
this.sidebar = document.getElementById("sidebar");
|
this.interface = new Interface(document.getElementById("sidebar"));
|
||||||
|
|
||||||
// Create a map to store information about other clients in
|
// Create a map to store information about other clients in
|
||||||
this.otherClients = new Map();
|
this.otherClients = new Map();
|
||||||
|
@ -331,8 +332,8 @@ class BoardWindow extends EventEmitter
|
||||||
this.Id = message.Id;
|
this.Id = message.Id;
|
||||||
this.Colour = message.Colour;
|
this.Colour = message.Colour;
|
||||||
|
|
||||||
this.sidebar.querySelector(".name").style.borderTopColor = this.Colour;
|
this.interface.OurColour = this.Colour;
|
||||||
this.sidebar.querySelector(".connection-indicator").dataset.connected = "yes";
|
this.interface.setConnectedStatus(true);
|
||||||
|
|
||||||
// The pencil that draws the lines
|
// The pencil that draws the lines
|
||||||
this.pencil = new Pencil(this.rippleLink, this, this.canvas);
|
this.pencil = new Pencil(this.rippleLink, this, this.canvas);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
window.EventEmitter = require("event-emitter-es6");
|
window.EventEmitter = require("event-emitter-es6");
|
||||||
|
|
||||||
class Sidebar extends EventEmitter
|
class Interface extends EventEmitter
|
||||||
{
|
{
|
||||||
constructor(inSidebar)
|
constructor(inSidebar)
|
||||||
{
|
{
|
||||||
|
@ -49,6 +49,23 @@ class Sidebar extends EventEmitter
|
||||||
delete this.sidebar.querySelector(".connection-indicator").dataset.connected;
|
delete this.sidebar.querySelector(".connection-indicator").dataset.connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches our colour from the ui.
|
||||||
|
*/
|
||||||
|
get OurColour()
|
||||||
|
{
|
||||||
|
return this.sidebar.querySelector(".name").style.borderTopColor;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Sets the colour displayed just above the name
|
||||||
|
* @param {HTMLColour} newColour The new colour to display jsut above the
|
||||||
|
* name in the sidebar.
|
||||||
|
*/
|
||||||
|
set OurColour(newColour)
|
||||||
|
{
|
||||||
|
this.sidebar.querySelector(".name").style.borderTopColor = newColour;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the username displayed.
|
* Updates the username displayed.
|
||||||
* @param {string} newName The new name to display inthe sidebar.
|
* @param {string} newName The new name to display inthe sidebar.
|
||||||
|
@ -61,4 +78,4 @@ class Sidebar extends EventEmitter
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Sidebar;
|
export default Interface;
|
|
@ -22,7 +22,7 @@ body
|
||||||
|
|
||||||
padding: 0.3em 0.45em;
|
padding: 0.3em 0.45em;
|
||||||
|
|
||||||
background: hsla(27, 91%, 81%, 0.71);
|
background: url(/images/transparent-square-tiles.png), hsla(27, 100%, 59%, 0.71);
|
||||||
box-shadow: 0.5em 0 1em rgba(185, 183, 183, 0.56);
|
box-shadow: 0.5em 0 1em rgba(185, 183, 183, 0.56);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class RippleLink extends EventEmitter
|
||||||
|
|
||||||
handleDisconnection(event) {
|
handleDisconnection(event) {
|
||||||
console.error("[ripple link] Lost connection.");
|
console.error("[ripple link] Lost connection.");
|
||||||
delete this.boardWindow.sidebar.querySelector(".connection-indicator").dataset.connected;
|
this.boardWindow.interface.setConnectedStatus(true);
|
||||||
|
|
||||||
this.emit("disconnect", event);
|
this.emit("disconnect", event);
|
||||||
}
|
}
|
||||||
|
|
BIN
Nibriboard/ClientFiles/images/transparent-square-tiles.png
Normal file
BIN
Nibriboard/ClientFiles/images/transparent-square-tiles.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -107,6 +107,7 @@
|
||||||
<EmbeddedResource Include="ClientFiles\Nibri.css" />
|
<EmbeddedResource Include="ClientFiles\Nibri.css" />
|
||||||
<EmbeddedResource Include="ClientFiles\favicon.ico" />
|
<EmbeddedResource Include="ClientFiles\favicon.ico" />
|
||||||
<EmbeddedResource Include="ClientFiles\nibriboard.svg" />
|
<EmbeddedResource Include="ClientFiles\nibriboard.svg" />
|
||||||
|
<EmbeddedResource Include="ClientFiles\images\transparent-square-tiles.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="RippleSpace\" />
|
<Folder Include="RippleSpace\" />
|
||||||
|
|
Loading…
Reference in a new issue