mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
cleaned up drag/drop code
This commit is contained in:
parent
34935fdee3
commit
d219e8fe08
@ -470,45 +470,18 @@ window.Groups = {
|
|||||||
greedy: true,
|
greedy: true,
|
||||||
drop: function(e){
|
drop: function(e){
|
||||||
$target = $(e.target);
|
$target = $(e.target);
|
||||||
|
$dragged.removeClass("willGroup")
|
||||||
|
|
||||||
// Only drop onto the top z-index
|
var group = $target.data("group");
|
||||||
if( $target.css("zIndex") < $dragged.data("topDropZIndex") ) return;
|
|
||||||
$dragged.data("topDropZIndex", $target.css("zIndex") );
|
|
||||||
$dragged.data("topDrop", $target);
|
|
||||||
|
|
||||||
// This strange timeout thing solves the problem of when
|
|
||||||
// something is dropped onto multiple potential drop targets.
|
|
||||||
// We wait a little bit to see get all drops, and then we have saved
|
|
||||||
// the top-most one and drop onto that.
|
|
||||||
clearTimeout( timeout );
|
|
||||||
var dragged = $dragged;
|
|
||||||
var target = $target;
|
|
||||||
timeout = setTimeout( function(){
|
|
||||||
dragged.removeClass("willGroup")
|
|
||||||
|
|
||||||
dragged.animate({
|
|
||||||
top: target.position().top+15,
|
|
||||||
left: target.position().left+15,
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
setTimeout( function(){
|
|
||||||
var group = $(target).data("group");
|
|
||||||
if( group == null ){
|
if( group == null ){
|
||||||
var group = new Group([target, dragged]);
|
var group = new Group([$target, $dragged]);
|
||||||
} else {
|
} else {
|
||||||
group.add( dragged );
|
group.add( $dragged );
|
||||||
}
|
}
|
||||||
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
|
|
||||||
}, 10 );
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
over: function(e){
|
over: function(e){
|
||||||
$dragged.addClass("willGroup");
|
$dragged.addClass("willGroup");
|
||||||
$dragged.data("topDropZIndex", 0);
|
|
||||||
},
|
},
|
||||||
out: function(){
|
out: function(){
|
||||||
$dragged.removeClass("willGroup");
|
$dragged.removeClass("willGroup");
|
||||||
|
Loading…
Reference in New Issue
Block a user