aboutsummaryrefslogtreecommitdiffhomepage
path: root/desktop
diff options
context:
space:
mode:
authorneauoire <[email protected]>2019-11-08 10:18:12 -0500
committerneauoire <[email protected]>2019-11-08 10:18:12 -0500
commit68a5622e91a16a733e72768ec905ea2b16a4da77 (patch)
tree4f1fe0b4cf905d291b1e2a0ab306418b9037a893 /desktop
parentb04044ff172e3d6066ece87de60d11c16f97bb6e (diff)
downloadOrca-68a5622e91a16a733e72768ec905ea2b16a4da77.tar.gz
Orca-68a5622e91a16a733e72768ec905ea2b16a4da77.zip
*
Diffstat (limited to 'desktop')
-rw-r--r--desktop/sources/scripts/client.js17
-rw-r--r--desktop/sources/scripts/core/library.js1
-rw-r--r--desktop/sources/scripts/core/orca.js2
3 files changed, 13 insertions, 7 deletions
diff --git a/desktop/sources/scripts/client.js b/desktop/sources/scripts/client.js
index d56743c..8b0d432 100644
--- a/desktop/sources/scripts/client.js
+++ b/desktop/sources/scripts/client.js
@@ -12,7 +12,7 @@
/* global Theme */
function Client () {
- this.version = 147
+ this.version = 148
this.library = library
this.theme = new Theme(this)
@@ -176,9 +176,9 @@ function Client () {
const h = lines.length
const s = lines.join('\n').trim()
- client.orca.load(w, h, s)
- client.history.reset()
- client.history.record(client.orca.s)
+ this.orca.load(w, h, s)
+ this.history.reset()
+ this.history.record(this.orca.s)
this.resize()
}
@@ -395,12 +395,17 @@ function Client () {
const pad = 30
const size = { w: window.innerWidth - (pad * 2), h: window.innerHeight - ((pad * 2) + this.tile.h * 2) }
const tiles = { w: Math.ceil(size.w / this.tile.w), h: Math.ceil(size.h / this.tile.h) }
+ const bounds = this.orca.bounds()
+
+ // Clamp at limits of orca file
+ if (tiles.w < bounds.w + 1) { tiles.w = bounds.w + 1 }
+ if (tiles.h < bounds.h + 1) { tiles.h = bounds.h + 1 }
this.crop(tiles.w, tiles.h)
// Keep cursor in bounds
- if (this.cursor.x >= tiles.w) { this.cursor.x = tiles.w - 1 }
- if (this.cursor.y >= tiles.h) { this.cursor.y = tiles.h - 1 }
+ 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
diff --git a/desktop/sources/scripts/core/library.js b/desktop/sources/scripts/core/library.js
index 35ae2e2..d5c3edf 100644
--- a/desktop/sources/scripts/core/library.js
+++ b/desktop/sources/scripts/core/library.js
@@ -1,6 +1,7 @@
'use strict'
/* global Operator */
+/* global client */
const library = {}
diff --git a/desktop/sources/scripts/core/orca.js b/desktop/sources/scripts/core/orca.js
index 49a83ac..1d65cf7 100644
--- a/desktop/sources/scripts/core/orca.js
+++ b/desktop/sources/scripts/core/orca.js
@@ -101,7 +101,7 @@ function Orca (library) {
}
}
}
- return { w: w, h: h }
+ return { w, h }
}
// Locks