diff --git a/desktop/sources/index.html b/desktop/sources/index.html index a7834ee..43ebb83 100644 --- a/desktop/sources/index.html +++ b/desktop/sources/index.html @@ -17,6 +17,7 @@ + diff --git a/desktop/sources/scripts/dotgrid.js b/desktop/sources/scripts/dotgrid.js index 329873b..99142c5 100644 --- a/desktop/sources/scripts/dotgrid.js +++ b/desktop/sources/scripts/dotgrid.js @@ -24,6 +24,7 @@ function Dotgrid (width, height) { this.interface = new Interface(this) this.picker = new Picker(this) this.cursor = new Cursor(this) + this.listener = new Listener(this) host.appendChild(this.renderer.el) diff --git a/desktop/sources/scripts/listener.js b/desktop/sources/scripts/listener.js new file mode 100644 index 0000000..7957e98 --- /dev/null +++ b/desktop/sources/scripts/listener.js @@ -0,0 +1,27 @@ +'use strict' + +const dgram = require('dgram') + +function Listener (dotgrid) { + this.server = dgram.createSocket('udp4') + + this.start = function () { + + } + + this.server.on('error', (err) => { + console.log(`server error:\n${err.stack}`) + server.close() + }) + + this.server.on('message', (msg, rinfo) => { + console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`) + }) + + this.server.on('listening', () => { + const address = this.server.address() + console.log(`server listening ${address.address}:${address.port}`) + }) + + this.server.bind(49160) +} diff --git a/desktop/sources/scripts/tool.js b/desktop/sources/scripts/tool.js index b4a788e..c29b5a0 100644 --- a/desktop/sources/scripts/tool.js +++ b/desktop/sources/scripts/tool.js @@ -355,7 +355,7 @@ function Tool (dotgrid) { this.selectLayer = function (id) { this.index = clamp(id, 0, 2) - + if (this.index !== 0) { this.settings.crest = false } this.clear()