diff options
author | neauoire <[email protected]> | 2019-12-24 10:06:46 -0500 |
---|---|---|
committer | neauoire <[email protected]> | 2019-12-24 10:06:46 -0500 |
commit | 84c0af17fbfe727ef62582ed6248d971fa36e1e5 (patch) | |
tree | 14db7f21445f29ad0e72e12e1a65bb4f95ac9b5e /desktop | |
parent | 3dab8e339ec49ef3546de259ba747b6c42724139 (diff) | |
download | Orca-84c0af17fbfe727ef62582ed6248d971fa36e1e5.tar.gz Orca-84c0af17fbfe727ef62582ed6248d971fa36e1e5.zip |
Minor optimisations to the client
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/package-lock.json | 12 | ||||
-rw-r--r-- | desktop/package.json | 2 | ||||
-rw-r--r-- | desktop/sources/scripts/client.js | 22 | ||||
-rw-r--r-- | desktop/sources/scripts/core/library.js | 2 |
4 files changed, 20 insertions, 18 deletions
diff --git a/desktop/package-lock.json b/desktop/package-lock.json index 48c52ae..8e25031 100644 --- a/desktop/package-lock.json +++ b/desktop/package-lock.json @@ -36,9 +36,9 @@ } }, "@types/node": { - "version": "12.12.17", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.17.tgz", - "integrity": "sha512-Is+l3mcHvs47sKy+afn2O1rV4ldZFU7W8101cNlOd+MRbjM4Onida8jSZnJdTe/0Pcf25g9BNIUsuugmE6puHA==", + "version": "12.12.22", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.22.tgz", + "integrity": "sha512-r5i93jqbPWGXYXxianGATOxTelkp6ih/U0WVnvaqAvTqM+0U6J3kw6Xk6uq/dWNRkEVw/0SLcO5ORXbVNz4FMQ==", "dev": true }, "asar": { @@ -317,9 +317,9 @@ "dev": true }, "electron": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/electron/-/electron-7.1.5.tgz", - "integrity": "sha512-jagsvNz6Axu2Lsp5PqDgkcR+4BwoPP9YyLgMu9lhpFNRNKpNgfsEqUbtNolkFN/TtmWjxGO+iioWRrGqZHmJ8w==", + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/electron/-/electron-7.1.7.tgz", + "integrity": "sha512-aCLJ4BJwnvOckJgovNul22AYlMFDzm4S4KqKCG2iBlFJyMHBxXAKFKMsgYd40LBZWS3hcY6RHpaYjHSAPLS1pw==", "dev": true, "requires": { "@electron/get": "^1.0.1", diff --git a/desktop/package.json b/desktop/package.json index baf2fd4..f78f6a4 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -19,7 +19,7 @@ "push": "npm run build ; npm run push_osx ; npm run push_linux ; npm run push_win ; npm run clean ; npm run status" }, "devDependencies": { - "electron": "^7.1.5", + "electron": "^7.1.7", "electron-packager": "^14.1.1" }, "dependencies": { diff --git a/desktop/sources/scripts/client.js b/desktop/sources/scripts/client.js index 2909522..b8f673a 100644 --- a/desktop/sources/scripts/client.js +++ b/desktop/sources/scripts/client.js @@ -12,7 +12,7 @@ /* global Theme */ function Client () { - this.version = 164 + this.version = 165 this.library = library this.theme = new Theme(this) @@ -27,12 +27,12 @@ function Client () { this.clock = new Clock(this) // Settings + this.scale = window.devicePixelRatio this.grid = { w: 8, h: 8 } this.tile = { w: +localStorage.getItem('tilew') || 10, h: +localStorage.getItem('tileh') || 15 } - this.scale = window.devicePixelRatio this.hardmode = true this.guide = false @@ -138,7 +138,7 @@ function Client () { this.cursor.start() this.reset() - this.resize() + this.modZoom() this.update() this.el.className = 'ready' @@ -218,7 +218,9 @@ function Client () { this.modZoom = (mod = 0, reset = false) => { this.tile = { w: reset ? 10 : this.tile.w * (mod + 1), - h: reset ? 15 : this.tile.h * (mod + 1) + h: reset ? 15 : this.tile.h * (mod + 1), + ws: Math.floor(this.tile.w * this.scale), + hs: Math.floor(this.tile.h * this.scale) } localStorage.setItem('tilew', this.tile.w) localStorage.setItem('tileh', this.tile.h) @@ -321,7 +323,7 @@ function Client () { this.write(`${this.cursor.w}:${this.cursor.h}`, this.grid.w * 2, this.orca.h, this.grid.w) this.write(`${this.orca.f}f${this.clock.isPaused ? '~' : ''}`, this.grid.w * 3, this.orca.h, this.grid.w) this.write(`${this.io.inspect(this.grid.w)}`, this.grid.w * 4, this.orca.h, this.grid.w - 1) - this.write(this.orca.f < 500 ? `< ${this.io.midi.toInputString()}` : '', this.grid.w * 5, this.orca.h, this.grid.w * 4) + this.write(this.orca.f < 75 ? `< ${this.io.midi.toInputString()}` : '', this.grid.w * 5, this.orca.h, this.grid.w * 4) if (this.commander.isActive === true) { this.write(`${this.commander.query}${this.orca.f % 2 === 0 ? '_' : ''}`, this.grid.w * 0, this.orca.h + 1, this.grid.w * 4) @@ -354,11 +356,11 @@ function Client () { const theme = this.makeTheme(type) if (theme.bg) { this.context.fillStyle = theme.bg - this.context.fillRect(x * this.tile.w * this.scale, (y) * this.tile.h * this.scale, this.tile.w * this.scale, this.tile.h * this.scale) + this.context.fillRect(x * this.tile.ws, (y) * this.tile.hs, this.tile.ws, this.tile.hs) } if (theme.fg) { this.context.fillStyle = theme.fg - this.context.fillText(g, (x + 0.5) * this.tile.w * this.scale, (y + 1) * this.tile.h * this.scale) + this.context.fillText(g, (x + 0.5) * this.tile.ws, (y + 1) * this.tile.hs) } } @@ -386,8 +388,8 @@ function Client () { if (this.cursor.x >= tiles.w) { this.cursor.moveTo(tiles.w - 1, this.cursor.y) } if (this.cursor.y >= tiles.h) { this.cursor.moveTo(this.cursor.x, tiles.h - 1) } - const w = this.tile.w * this.orca.w * this.scale - const h = (this.tile.h + (this.tile.h / 5)) * this.orca.h * this.scale + const w = this.tile.ws * this.orca.w + const h = (this.tile.hs + (this.tile.hs / 5)) * this.orca.h if (w === this.el.width && h === this.el.height) { return } @@ -400,7 +402,7 @@ function Client () { this.context.textBaseline = 'bottom' this.context.textAlign = 'center' - this.context.font = `${this.tile.h * 0.75 * this.scale}px input_mono_medium` + this.context.font = `${this.tile.hs * 0.75}px input_mono_medium` this.update() } diff --git a/desktop/sources/scripts/core/library.js b/desktop/sources/scripts/core/library.js index 361fc82..679a21c 100644 --- a/desktop/sources/scripts/core/library.js +++ b/desktop/sources/scripts/core/library.js @@ -52,7 +52,7 @@ library.c = function OperatorC (orca, x, y, passive) { this.operation = function (force = false) { const rate = this.listen(this.ports.rate, true) const mod = this.listen(this.ports.mod, true) - const val = Math.floor(orca.f / rate) % mod + const val = orca.f % (mod * rate) return orca.keyOf(val) } } |