Added svg support

This commit is contained in:
neauoire 2020-03-27 08:31:05 +09:00
parent 3b07edefc4
commit 58f504a8f8
2 changed files with 6 additions and 5 deletions

View File

@ -605,8 +605,7 @@ function Client () {
if (file.name.indexOf('.lisp') > -1) {
this.source.read(file, this.whenOpen)
this.log('Loaded ' + file.name)
}
if (file.type === 'image/jpeg' || file.type === 'image/png') {
} else if (file.type.substr(0, 5) === 'image') {
const img = new Image()
img.onload = () => {
this.cache.set(file.name, img)
@ -614,6 +613,8 @@ function Client () {
this.log('Loaded ' + file.name)
}
img.src = URL.createObjectURL(file)
} else {
console.warn('Unknown format', file)
}
}
this.cache = {

View File

@ -172,9 +172,7 @@ function Client () {
if (file.name.indexOf('.lisp') > -1) {
this.source.read(file, this.whenOpen)
this.log('Loaded ' + file.name)
}
if (file.type === 'image/jpeg' || file.type === 'image/png') {
} else if (file.type.substr(0, 5) === 'image') {
const img = new Image()
img.onload = () => {
this.cache.set(file.name, img)
@ -182,6 +180,8 @@ function Client () {
this.log('Loaded ' + file.name)
}
img.src = URL.createObjectURL(file)
} else {
console.warn('Unknown format', file)
}
}