MHTTPB7SEASBQCJB23VRM2LZTB6APNSBPNREC2SYTLN7ZRAXCSIAC
GZOEMNENF6GMM3RMGNDUJA76VC75ILUBBXUBOSQR36XF6QCM77CQC
WQJOSI3PIODMJUXE6TMCDDTWOTABMHLQZ2NTBLPT7RXC5I52UEMAC
AGPU6SD7V5FQNI6W54HDRJQCVHWYCZIHDHL6IL5LVVMJ7SVJL7UAC
6PSALZKWII5BVJZG7DOPH2SNY2Q4CJR6QSMROXCTVSJ6UPX2RIUAC
OQDFFOFENHOGPMR6DWAIEYUKRKBVQHJNVTDVWFUTZTVMOJECWKSQC
B2X5NJ7QAQTOZXHDAGANNGNYHTPN6LWKTJTL5IM6VBP4NETHHS5AC
724VCBER2VZZIIKK56NHQORXQKXI4GCWKOBKZZ4P5TXWTMEY6FXAC
// Update the cluster
socket.send(JSON.stringify({
Screens: this.cluster.screens.map((screen, id) => {
if (this.screens[id]) {
// Update the edges
var edges = this.screens[id].edges;
screen.edges = {
left: edges[0][0] ? edges[0][0].id : null,
right: edges[0][1] ? edges[0][1].id : null,
top: edges[1][0] ? edges[1][0].id : null,
bottom: edges[1][1] ? edges[1][1].id : null,
};
}
return screen;
}),
}));
Canvas.prototype.getScreens = function() {
return this.screens.filter((screen) => {
// Ignore screens that have focuses on them
for (var key in this.focuses) {
if (screen == this.focuses[key].target) {
return false;
}
}
return true;
Canvas.prototype.replaceCluster = function(cluster) {
this.cluster = cluster;
this.screens.forEach((screen) => {
screen.elem.parentElement.removeChild(screen.elem)
Canvas.prototype.addScreen = function(pos) {
var id = this.screens.length;
Canvas.prototype.addScreens = function(cluster, id, pos) {
var obj = this.screens[id];
if (obj) return obj;
var obj = cluster.screens[id];
if (!obj) return null;
name: this.names[this.nameIndex],
name: obj.name,
pos: pos,
size: [200, 125],
local: cluster.local_screen === id,
});
this.screens[id] = screen;
this.view.appendChild(screen.elem);
// Resolve edges
screen.edges = [[
this.addScreens(cluster, obj.edges.left, vectorSub(pos, [screen.size[0] + gridPad, 0])),
this.addScreens(cluster, obj.edges.right, vectorAdd(pos, [screen.size[0] + gridPad, 0])),
], [
this.addScreens(cluster, obj.edges.top, vectorSub(pos, [0, screen.size[1] + gridPad])),
this.addScreens(cluster, obj.edges.bottom, vectorAdd(pos, [0, screen.size[1] + gridPad])),
]];
return screen;
};
Canvas.prototype.addDummyScreen = function(pos) {
var screen = new Screen({
id: this.screens.length,
name: "Dummy Screen",
// Walk around the graph to find direct neighbours (only works in 2D)
other.edges[1 - dim].forEach((screen, pathSide) => {
if (!screen) return;
screen = screen.edges[dim][side];
if (!screen) return;
// Walk around graph through adjacent dimensions to find neighbours
other.edges.filter((edgeDim, pathDim) => {
return pathDim != dim;
}).forEach((edgeDim, pathDim) => {
edgeDim.forEach((screen, pathSide) => {
if (!screen) return;
screen = screen.edges[dim][side];
if (!screen) return;
// Found a neighbour (if found by one path, should be found by all paths)
this.edges[dim][side] = screen;
screen.edges[dim][1 - side] = this;
// Found a neighbour (if found by one path, should be found by all paths)
this.edges[dim][side] = screen;
screen.edges[dim][1 - side] = this;
});
var ws = new WebSocket("ws://127.0.0.1:3012");
ws.onopen = function(e) {
new Canvas(document.querySelector('.canvas'));
var socket = new WebSocket("ws://127.0.0.1:3012");
socket.onopen = function(e) {
new Canvas(document.querySelector('.canvas'), socket);