mirror of
https://github.com/umap-project/umap.git
synced 2025-04-30 20:12:37 +02:00
fix: zoom to droped file once loaded
This commit is contained in:
parent
49d1dbf36e
commit
3fff54baab
2 changed files with 12 additions and 7 deletions
|
@ -124,6 +124,11 @@ export default class Importer extends Utils.WithTemplate {
|
|||
return this.qs('[type=file]').files
|
||||
}
|
||||
|
||||
set files(files) {
|
||||
this.qs('[type=file]').files = files
|
||||
this.onFileChange()
|
||||
}
|
||||
|
||||
get raw() {
|
||||
return this.qs('textarea').value
|
||||
}
|
||||
|
@ -213,11 +218,11 @@ export default class Importer extends Utils.WithTemplate {
|
|||
this.qs('[name=submit').toggleAttribute('disabled', !this.canSubmit())
|
||||
}
|
||||
|
||||
onFileChange(e) {
|
||||
onFileChange() {
|
||||
let type = ''
|
||||
let newType
|
||||
for (const file of e.target.files) {
|
||||
newType = U.Utils.detectFileType(file)
|
||||
for (const file of this.files) {
|
||||
newType = Utils.detectFileType(file)
|
||||
if (!type && newType) type = newType
|
||||
if (type && newType !== type) {
|
||||
type = ''
|
||||
|
|
|
@ -371,10 +371,10 @@ U.DropControl = L.Class.extend({
|
|||
this.map.scrollWheelZoom.enable()
|
||||
this.dropzone.classList.remove('umap-dragover')
|
||||
L.DomEvent.stop(event)
|
||||
for (const file of event.dataTransfer.files) {
|
||||
this.map._umap.processFileToImport(file)
|
||||
}
|
||||
this.map._umap.onceDataLoaded(this.map._umap.fitDataBounds)
|
||||
const importer = this.map._umap.importer
|
||||
importer.build()
|
||||
importer.files = event.dataTransfer.files
|
||||
importer.submit()
|
||||
},
|
||||
|
||||
dragleave: function () {
|
||||
|
|
Loading…
Reference in a new issue