mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20: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++) {
|
for (var i = 0, f; f = files[i]; i++) {
|
||||||
// only images...
|
// only images...
|
||||||
if (!f.type.match('image.*')) {
|
if (!f.type.match('image.*')) {
|
||||||
continue
|
continue }
|
||||||
}
|
|
||||||
|
|
||||||
if(f.path){
|
if(f.path){
|
||||||
paths.push(f.path)
|
paths.push(f.path)
|
||||||
@ -66,9 +65,7 @@ module.DragAndDrop = core.ImageGridFeatures.Feature({
|
|||||||
that.ribbons.updateImage(gid)
|
that.ribbons.updateImage(gid)
|
||||||
} })(f)
|
} })(f)
|
||||||
|
|
||||||
reader.readAsDataURL(f)
|
reader.readAsDataURL(f) } }
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(paths.length > 0){
|
if(paths.length > 0){
|
||||||
that.loadURLs(paths)
|
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
|
// add the generated stuff to the list -- this will help us id the
|
||||||
// images when they are loaded later...
|
// images when they are loaded later...
|
||||||
that.images.forEach(function(gid, img){
|
that.images
|
||||||
lst[img.path].gid = gid
|
.forEach(function(gid, img){
|
||||||
img.name = img.path.split('.').slice(0, -1).join('.')
|
lst[img.path].gid = gid
|
||||||
})
|
img.name = img.path
|
||||||
}
|
.split('.')
|
||||||
}
|
.slice(0, -1)
|
||||||
|
.join('.') }) } }
|
||||||
function handleDragOver(evt) {
|
function handleDragOver(evt) {
|
||||||
evt.stopPropagation()
|
evt.stopPropagation()
|
||||||
evt.preventDefault()
|
evt.preventDefault()
|
||||||
// Explicitly show this is a copy...
|
// Explicitly show this is a copy...
|
||||||
evt.dataTransfer.dropEffect = 'copy'
|
evt.dataTransfer.dropEffect = 'copy' }
|
||||||
}
|
|
||||||
|
|
||||||
// handle drop events...
|
// handle drop events...
|
||||||
this.ribbons.viewer[0]
|
this.ribbons.viewer[0]
|
||||||
.addEventListener('dragover', handleDragOver, false);
|
.addEventListener('dragover', handleDragOver, false);
|
||||||
this.ribbons.viewer[0]
|
this.ribbons.viewer[0]
|
||||||
.addEventListener('drop', handleDrop, false)
|
.addEventListener('drop', handleDrop, false) }] ],
|
||||||
}]
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user