Skip to content

Commit

Permalink
change draggable callback handler
Browse files Browse the repository at this point in the history
  • Loading branch information
kombai committed Nov 2, 2014
1 parent 24058d0 commit 3a63bcf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
9 changes: 4 additions & 5 deletions example/draggable.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,16 @@ <h1><a href="http://vnjs.net/www/project/freewall/">Free Wall</a></h1>

var wall = new freewall("#freewall");
wall.reset({
draggable: {
onDrop: function(event) {
console.log(this);
}
},
draggable: true,
selector: '.cell',
animate: true,
cellW: 150,
cellH: 150,
onResize: function() {
wall.refresh();
},
onBlockMove: function() {
console.log(this);
}
});
wall.fitWidth();
Expand Down
17 changes: 7 additions & 10 deletions freewall.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
onGapFound: function() {},
onComplete: function() {},
onResize: function() {},
onBlockDrag: function() {},
onBlockMove: function() {},
onBlockDrop: function() {},
onBlockReady: function() {},
onBlockFinish: function() {},
onBlockActive: function() {},
Expand Down Expand Up @@ -797,10 +800,8 @@
layoutManager.setTransition(this, "");
}
$item.css('z-index', 9999).addClass('fw-float');

if (setting.draggable && setting.draggable.onDragStart) {
setting.draggable.onDragStart.call(item, event);
}

setting.onBlockDrag.call(item, event);
},
onDrag: function(event, tracker) {
var position = $item.position();
Expand All @@ -813,9 +814,7 @@
klass.setHoles({top: top, left: left, width: width, height: height});
klass.refresh();

if (setting.draggable && setting.draggable.onDrag) {
setting.draggable.onDrag.call(item, event);
}
setting.onBlockMove.call(item, event);
},
onDrop: function(event) {
var position = $item.position();
Expand Down Expand Up @@ -855,9 +854,7 @@

klass.refresh();

if (setting.draggable && setting.draggable.onDrop) {
setting.draggable.onDrop.call(item, event);
}
setting.onBlockDrop.call(item, event);
}
});
}
Expand Down

0 comments on commit 3a63bcf

Please sign in to comment.