Added full commander expand

This commit is contained in:
Devine Lu Linvega 2019-07-20 15:49:34 +09:00
parent 7d88b6deb8
commit 93c69db908
6 changed files with 48 additions and 15 deletions

View File

@ -45,6 +45,7 @@
ronin.controller.add("default","View","Zoom Out",() => { ronin.modZoom(-0.25) },"CmdOrCtrl+-")
ronin.controller.add("default","View","Zoom Reset",() => { ronin.modZoom(1,true) },"CmdOrCtrl+0")
ronin.controller.add("default","View","Toggle Commander",() => { ronin.commander.toggle(); },"CmdOrCtrl+K");
ronin.controller.add("default","View","Expand Commander",() => { ronin.commander.toggle(true); },"CmdOrCtrl+Shift+K");
ronin.controller.add("default","Project","Run",() => { ronin.commander.run(); },"CmdOrCtrl+R");
ronin.controller.add("default","Project","Reload Run",() => { ronin.source.revert(); ronin.commander.run(); },"CmdOrCtrl+Shift+R");
ronin.controller.add("default","Project", "Animate",() => { ronin.animate(!ronin.always); },"CmdOrCtrl+Shift+T");

View File

@ -7,6 +7,7 @@ body { margin:0px; padding:0px; overflow:hidden; font-family:"input_mono_regular
#ronin #wrapper #commander { z-index: 9000;position: relative;width: 310px;height: calc(100vh - 60px);-webkit-app-region: no-drag;padding-right: 30px;transition: margin-left 250ms;}
#ronin #wrapper #commander textarea { background: none; width: 100%; height: calc(100vh - 105px); resize: none; font-size: 12px;line-height: 15px; padding-right: 15px}
#ronin #wrapper #commander div#status { position: absolute; bottom: 0px; text-transform: lowercase;}
#ronin.expand #wrapper #commander { width:100%; }
#ronin.hidden #wrapper #commander { margin-left:-331px; }
#ronin canvas#surface,#ronin canvas#guide { position: absolute; top:0px; -webkit-user-select: none;-webkit-app-region: no-drag; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20'><circle cx='10' cy='10' r='1' fill='%23555'></circle></svg>"); background-size: 10px 10px; background-position: -4px -4px; width:100%; height:100%; left:340px; transition: left 250ms}

View File

@ -188,9 +188,9 @@ function Commander (ronin) {
// Display
this.show = function () {
this.show = function (expand = false) {
if (this.isVisible === true) { return }
ronin.el.className = ''
ronin.el.className = expand ? 'expand' : ''
this.isVisible = true
}
@ -200,9 +200,9 @@ function Commander (ronin) {
this.isVisible = false
}
this.toggle = function () {
this.toggle = function (expand = false) {
if (this.isVisible !== true) {
this.show()
this.show(expand)
} else {
this.hide()
}

View File

@ -60,6 +60,12 @@ function Library (ronin) {
return rect
}
// Strings
this.concat = function (...items) {
return items.reduce((acc, item) => { return `${acc}${item}` }, '')
}
// Math
this.add = (...args) => { // Adds values.
@ -319,7 +325,17 @@ function Library (ronin) {
return ronin.surface.open(path)
}
this.folder = (path = ronin.source.path) => { // Returns the content of a folder path.
// File System
this.path = (path = ronin.source.path) => { // Returns the content of a folder path.
return path
}
this.folder = (path = this.path()) => { // Returns the path of the current folder.
return require('path').dirname(path)
}
this.ls = (path = this.folder()) => { // Returns the content of a folder path.
return fs.existsSync(path) ? fs.readdirSync(path) : []
}

View File

@ -1,13 +1,17 @@
; animate
(
(clear)
(def t (sin (div (time) 100)))
(def pos (add 200 30 (mul 30 t)))
(defn square (a) (rect a a a a))
(stroke (square pos) 1 "red")
(clear)
(def t
(sin
(div
(time) 100)))
(def pos
(add 200 30
(mul 30 t)))
(defn square
(a)
(rect a a a a))
(stroke
(square pos) 1 "red")
; set false to stop
(animate true)
)
(animate true))

11
examples/fs.lisp Normal file
View File

@ -0,0 +1,11 @@
; filesystem
(
; get files
(def files
(ls
(folder)))
; print files count
(echo
(concat "Current folder: "
(folder) " contains "
(len files) " files"))))