file drop sidebar update
This commit is contained in:
parent
4917e87b65
commit
21faf348f7
8
main.js
8
main.js
@ -126,13 +126,11 @@ function fileDrop(e) {
|
|||||||
type = e.dataTransfer.files;
|
type = e.dataTransfer.files;
|
||||||
}
|
}
|
||||||
if(!e.dataTransfer.items) return;
|
if(!e.dataTransfer.items) return;
|
||||||
var diff = allSets.length;
|
loadSVGStatus(true);
|
||||||
for (var i = 0; i < type.length; i++) {
|
for (var i = 0; i < type.length; i++) {
|
||||||
var thisItem = type[i];
|
var thisItem = type[i];
|
||||||
if (thisItem.kind === 'file') {
|
if (thisItem.kind === 'file') {
|
||||||
loadSVGStatus(true);
|
|
||||||
var file = thisItem.getAsFile();
|
var file = thisItem.getAsFile();
|
||||||
setTimeout(function() {
|
|
||||||
if(file.name.search(".svg") === -1) {
|
if(file.name.search(".svg") === -1) {
|
||||||
alert("This file is not an svg! Please select another file.");
|
alert("This file is not an svg! Please select another file.");
|
||||||
loadSVGStatus(false);
|
loadSVGStatus(false);
|
||||||
@ -150,7 +148,6 @@ function fileDrop(e) {
|
|||||||
"calcArray": []
|
"calcArray": []
|
||||||
};
|
};
|
||||||
allSets.push(oneSet);
|
allSets.push(oneSet);
|
||||||
if(allSets.length-diff === e.dataTransfer.items.length) updateSidebar();
|
|
||||||
}
|
}
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
if(e.dataTransfer.items) {
|
if(e.dataTransfer.items) {
|
||||||
@ -158,10 +155,9 @@ function fileDrop(e) {
|
|||||||
} else {
|
} else {
|
||||||
e.dataTransfer.clearData();
|
e.dataTransfer.clearData();
|
||||||
}
|
}
|
||||||
}, 10);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateSidebar();
|
||||||
}
|
}
|
||||||
|
|
||||||
function fileDrag(e) {
|
function fileDrag(e) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user