Added files fn
This commit is contained in:
@@ -158,17 +158,7 @@ function Client () {
|
||||
this.mouseOrigin = null
|
||||
}
|
||||
|
||||
this.onDrag = (e) => {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
e.dataTransfer.dropEffect = 'copy'
|
||||
}
|
||||
|
||||
this.onDrop = (e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
const file = e.dataTransfer.files[0]
|
||||
|
||||
this.parseFile = (file) => {
|
||||
if (file.name.indexOf('.lisp') > -1) {
|
||||
this.source.read(file, this.whenOpen)
|
||||
this.log('Loaded ' + file.name)
|
||||
@@ -185,6 +175,20 @@ function Client () {
|
||||
}
|
||||
}
|
||||
|
||||
this.onDrag = (e) => {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
e.dataTransfer.dropEffect = 'copy'
|
||||
}
|
||||
|
||||
this.onDrop = (e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
for (const file of e.dataTransfer.files) {
|
||||
this.parseFile(file)
|
||||
}
|
||||
}
|
||||
|
||||
this.cache = {
|
||||
data: {},
|
||||
set: (key, content) => {
|
||||
|
||||
@@ -25,6 +25,10 @@ function Library (client) {
|
||||
client.source.write('ronin', format, client.surface.el.toDataURL(type, quality), type)
|
||||
}
|
||||
|
||||
this.files = () => {
|
||||
return Object.keys(client.cache.data)
|
||||
}
|
||||
|
||||
// Shapes
|
||||
|
||||
this.pos = (x = 0, y = 0) => { // Returns a position shape.
|
||||
|
||||
Reference in New Issue
Block a user