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
|
return this.qs('[type=file]').files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set files(files) {
|
||||||
|
this.qs('[type=file]').files = files
|
||||||
|
this.onFileChange()
|
||||||
|
}
|
||||||
|
|
||||||
get raw() {
|
get raw() {
|
||||||
return this.qs('textarea').value
|
return this.qs('textarea').value
|
||||||
}
|
}
|
||||||
|
@ -213,11 +218,11 @@ export default class Importer extends Utils.WithTemplate {
|
||||||
this.qs('[name=submit').toggleAttribute('disabled', !this.canSubmit())
|
this.qs('[name=submit').toggleAttribute('disabled', !this.canSubmit())
|
||||||
}
|
}
|
||||||
|
|
||||||
onFileChange(e) {
|
onFileChange() {
|
||||||
let type = ''
|
let type = ''
|
||||||
let newType
|
let newType
|
||||||
for (const file of e.target.files) {
|
for (const file of this.files) {
|
||||||
newType = U.Utils.detectFileType(file)
|
newType = Utils.detectFileType(file)
|
||||||
if (!type && newType) type = newType
|
if (!type && newType) type = newType
|
||||||
if (type && newType !== type) {
|
if (type && newType !== type) {
|
||||||
type = ''
|
type = ''
|
||||||
|
|
|
@ -371,10 +371,10 @@ U.DropControl = L.Class.extend({
|
||||||
this.map.scrollWheelZoom.enable()
|
this.map.scrollWheelZoom.enable()
|
||||||
this.dropzone.classList.remove('umap-dragover')
|
this.dropzone.classList.remove('umap-dragover')
|
||||||
L.DomEvent.stop(event)
|
L.DomEvent.stop(event)
|
||||||
for (const file of event.dataTransfer.files) {
|
const importer = this.map._umap.importer
|
||||||
this.map._umap.processFileToImport(file)
|
importer.build()
|
||||||
}
|
importer.files = event.dataTransfer.files
|
||||||
this.map._umap.onceDataLoaded(this.map._umap.fitDataBounds)
|
importer.submit()
|
||||||
},
|
},
|
||||||
|
|
||||||
dragleave: function () {
|
dragleave: function () {
|
||||||
|
|
Loading…
Reference in a new issue