ronin/desktop/sources/scripts/commander.js
Devine Lu Linvega 7b14b94c58 Starting library
2019-07-13 11:43:50 +09:00

55 lines
1004 B
JavaScript

function Commander (ronin) {
this.el = document.createElement('yu')
this.el.id = 'commander'
this._input = document.createElement('textarea')
this._status = document.createElement('div')
this._status.id = 'status'
this.install = function (host) {
this.el.appendChild(this._input)
this.el.appendChild(this._status)
host.appendChild(this.el)
this._input.addEventListener('input', this.onInput)
}
this.start = function () {
this._input.value = `
(clear)
; Get Image
(load "../media/test.png"
(rect 0 0 600 600))
; Some operations
(scale 0.5 0.5
(resize 150 150
(crop
(rect 0 0 300 300))))`.trim()
this._status.textContent = 'Idle, RUN(cmd+enter).'
this._input.focus()
this.run()
}
this.run = function (txt = this._input.value) {
const inter = new Lisp(txt, ronin.library)
console.log(inter.toPixels())
}
this.update = function () {
}
this.onInput = function () {
}
this.getQuery = function () {
}
}