Improved controls

This commit is contained in:
neauoire
2020-03-25 19:30:33 +09:00
parent 2387542efc
commit 12bba32b5d
4 changed files with 93 additions and 41 deletions

View File

@@ -539,7 +539,7 @@ function Client () {
this.acels.set('File', 'New', 'CmdOrCtrl+N', () => { this.source.new(); this.surface.clear(); this.commander.clear() })
this.acels.set('File', 'Save', 'CmdOrCtrl+S', () => { this.source.write('ronin', 'lisp', this.commander._input.value, 'text/plain') })
this.acels.set('File', 'Export Image', 'CmdOrCtrl+E', () => { this.source.write('ronin', 'png', this.surface.el.toDataURL('image/png', 1.0), 'image/png') })
this.acels.set('File', 'Open', 'CmdOrCtrl+O', () => { this.source.open('lisp', this.whenOpen) })
this.acels.set('File', 'Open', 'CmdOrCtrl+U', () => { this.source.open('lisp', this.whenOpen) })
this.acels.add('Edit', 'undo')
this.acels.add('Edit', 'redo')
this.acels.add('Edit', 'cut')
@@ -1353,18 +1353,6 @@ function Library (client) {
[-1, 9, -1],
[-1, -1, -1]]
}
this.dir = (path = this.dirpath()) => { // Returns the content of a directory.
}
this.file = (path = this.filepath()) => { // Returns the content of a file.
}
this.dirpath = (path = this.filepath()) => { // Returns the path of a directory.
}
this.filepath = (path = client.source.path) => { // Returns the path of a file.
}
this.dirname = (path = this.filepath()) => { // Returns the name of a folder.
}
this.filename = (path = this.filepath()) => { // Returns the name of a file.
}
this.offset = (a, b) => { // Offsets pos a with pos b, returns a.
a.x += b.x
a.y += b.y
@@ -1373,6 +1361,10 @@ function Library (client) {
this.distance = (a, b) => { // Get distance between positions.
return Math.sqrt(((a.x - b.x) * (a.x - b.x)) + ((a.y - b.y) * (a.y - b.y)))
}
this.print = (value) => {
client.source.write('ronin-print', 'txt', value, 'text/plain')
return value
}
this.echo = (...args) => { // Print arguments to interface.
client.log(args)
return args