mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
55c80011f5
commit
f19894bf39
@ -46,8 +46,7 @@ module.DragAndDrop = core.ImageGridFeatures.Feature({
|
||||
for (var i = 0, f; f = files[i]; i++) {
|
||||
// only images...
|
||||
if (!f.type.match('image.*')) {
|
||||
continue
|
||||
}
|
||||
continue }
|
||||
|
||||
if(f.path){
|
||||
paths.push(f.path)
|
||||
@ -66,9 +65,7 @@ module.DragAndDrop = core.ImageGridFeatures.Feature({
|
||||
that.ribbons.updateImage(gid)
|
||||
} })(f)
|
||||
|
||||
reader.readAsDataURL(f)
|
||||
}
|
||||
}
|
||||
reader.readAsDataURL(f) } }
|
||||
|
||||
if(paths.length > 0){
|
||||
that.loadURLs(paths)
|
||||
@ -78,26 +75,24 @@ module.DragAndDrop = core.ImageGridFeatures.Feature({
|
||||
|
||||
// add the generated stuff to the list -- this will help us id the
|
||||
// images when they are loaded later...
|
||||
that.images.forEach(function(gid, img){
|
||||
lst[img.path].gid = gid
|
||||
img.name = img.path.split('.').slice(0, -1).join('.')
|
||||
})
|
||||
}
|
||||
}
|
||||
that.images
|
||||
.forEach(function(gid, img){
|
||||
lst[img.path].gid = gid
|
||||
img.name = img.path
|
||||
.split('.')
|
||||
.slice(0, -1)
|
||||
.join('.') }) } }
|
||||
function handleDragOver(evt) {
|
||||
evt.stopPropagation()
|
||||
evt.preventDefault()
|
||||
// Explicitly show this is a copy...
|
||||
evt.dataTransfer.dropEffect = 'copy'
|
||||
}
|
||||
evt.dataTransfer.dropEffect = 'copy' }
|
||||
|
||||
// handle drop events...
|
||||
this.ribbons.viewer[0]
|
||||
.addEventListener('dragover', handleDragOver, false);
|
||||
this.ribbons.viewer[0]
|
||||
.addEventListener('drop', handleDrop, false)
|
||||
}]
|
||||
],
|
||||
.addEventListener('drop', handleDrop, false) }] ],
|
||||
})
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user