Added files fn
This commit is contained in:
25
index.html
25
index.html
@@ -593,15 +593,7 @@ function Client () {
|
||||
this.onMouseOut = (e) => {
|
||||
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)
|
||||
@@ -617,6 +609,18 @@ function Client () {
|
||||
console.warn('Unknown format', file)
|
||||
}
|
||||
}
|
||||
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) => {
|
||||
@@ -900,6 +904,9 @@ function Library (client) {
|
||||
const type = `image/${format === 'jpeg' || format === 'jpg' ? 'jpeg' : 'png'}`
|
||||
client.source.write('ronin', format, client.surface.el.toDataURL(type, quality), type)
|
||||
}
|
||||
this.files = () => {
|
||||
return Object.keys(client.cache.data)
|
||||
}
|
||||
this.pos = (x = 0, y = 0) => { // Returns a position shape.
|
||||
return { x, y }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user