diff --git a/404.html b/404.html new file mode 100644 index 0000000..b71f010 --- /dev/null +++ b/404.html @@ -0,0 +1,15 @@ +--- +permalink: /404.html +--- + + +
+ +
diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js
index db2f25b..0d580fd 100644
--- a/desktop/sources/scripts/library.js
+++ b/desktop/sources/scripts/library.js
@@ -10,17 +10,17 @@ function Library (ronin) {
// IO
this.import = async (path, shape, alpha = 1) => { // Imports a graphic file with format.
- const img = new Image()
- img.src = path
- return ronin.surface.draw(img, shape, alpha)
+ // const img = new Image()
+ // img.src = path
+ // return ronin.surface.draw(img, shape, alpha)
}
- this.export = (path, quality = 1.0) => { // Exports a graphic file with format.
- // if (!path) { console.warn('Missing export path'); return path }
- // const dataUrl = ronin.surface.el.toDataURL(path.indexOf('.jpg') > -1 ? 'image/jpeg' : path.indexOf('.png') > -1 ? 'image/png' : format, quality)
- // const data = dataUrl.replace(/^data:image\/png;base64,/, '').replace(/^data:image\/jpeg;base64,/, '')
- // fs.writeFileSync(path, data, 'base64')
- // return path
+ this.export = (name = 'export', type = 'image/png', quality = 1.0) => { // Exports a graphic file with format.
+ const base64 = ronin.surface.el.toDataURL(type, quality)
+ const link = document.createElement('a')
+ link.setAttribute('href', base64)
+ link.setAttribute('download', type === 'image/png' ? name + '.png' : name + '.jpg')
+ link.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
}
this.open = async (path, ratio = 1) => { // Imports a graphic file and resizes the frame.
diff --git a/desktop/sources/scripts/ronin.js b/desktop/sources/scripts/ronin.js
index 3d0447d..2c48f6b 100644
--- a/desktop/sources/scripts/ronin.js
+++ b/desktop/sources/scripts/ronin.js
@@ -83,11 +83,7 @@ function Ronin () {
requestAnimationFrame(() => this.loop())
}
- this.reset = function () {
- this.theme.reset()
- }
-
- this.log = function (...msg) {
+ this.log = (...msg) => {
this.commander.setStatus(msg.reduce((acc, val) => {
return acc + JSON.stringify(val).replace(/"/g, '').trim() + ' '
}, ''))
diff --git a/desktop/sources/scripts/surface.js b/desktop/sources/scripts/surface.js
index 86def2a..b57db01 100644
--- a/desktop/sources/scripts/surface.js
+++ b/desktop/sources/scripts/surface.js
@@ -293,10 +293,11 @@ function Surface (ronin) {
}
this.fitWindow = function (size) {
- const win = require('electron').remote.getCurrentWindow()
- const pad = { w: ronin.commander.isVisible === true ? 400 : 60, h: 60 }
- if (size.w < 10 || size.h < 10) { return }
- win.setSize(Math.floor((size.w / this.ratio) + pad.w), Math.floor((size.h / this.ratio) + pad.h), true)
+ console.log('TODO')
+ // const win = require('electron').remote.getCurrentWindow()
+ // const pad = { w: ronin.commander.isVisible === true ? 400 : 60, h: 60 }
+ // if (size.w < 10 || size.h < 10) { return }
+ // win.setSize(Math.floor((size.w / this.ratio) + pad.w), Math.floor((size.h / this.ratio) + pad.h), true)
}
this.maximize = () => {
diff --git a/examples/basics/benchmark.lisp b/examples/basics/benchmark.lisp
index c4fe494..5f19776 100644
--- a/examples/basics/benchmark.lisp
+++ b/examples/basics/benchmark.lisp
@@ -57,13 +57,4 @@
; Interop
(test "interop" ((of (of (js) "Math") "max") 2 4) 4)
- (test "recursive key selector" ((of (js) "Math" "max") 2 4) 4)
-
-; fs
-
-; filesystem
-
-(echo (filepath))
-(echo (dirpath))
-(echo (file))
-(echo (dir))
+ (test "recursive key selector" ((of (js) "Math" "max") 2 4) 4)
\ No newline at end of file
diff --git a/examples/basics/recursive.lisp b/examples/basics/recursive.lisp
deleted file mode 100644
index c532230..0000000
--- a/examples/basics/recursive.lisp
+++ /dev/null
@@ -1,16 +0,0 @@
-; recursive
-
-(clear)
-(defn rec
- (v)
- (if
- (gt v 0)
- (
- (stroke
- (circle
- (mul 5 v)
- (mul 5 v)
- (mul 5 v)) "red" 1)
- (rec
- (sub v 5)))))
-(rec 100)
\ No newline at end of file