Add a transition on panel closing (swipe close)

This commit is contained in:
2022-09-27 17:23:21 +02:00
parent 303f903120
commit 559188413e
5 changed files with 39 additions and 13 deletions

View File

@@ -381,7 +381,7 @@ $.prototype.hoverSwap = function(sDefault, sHover)
.text(sDefault);
};
$.prototype.onSwipe = function(fOnEnd){
$.prototype.onSwipe = function(fOnMove, fOnEnd){
return $(this)
.on('dragstart', (e) => {
e.preventDefault();
@@ -399,17 +399,25 @@ $.prototype.onSwipe = function(fOnEnd){
var oPos = getDragPosition(e);
$This.data('x-move', oPos.x);
$This.data('y-move', oPos.y);
fOnMove({
xStart: $This.data('x-start'),
yStart: $This.data('y-start'),
xMove: $This.data('x-move'),
yMove: $This.data('y-move')
});
}
})
.on('mouseup mouseleave touchend', (e) => {
var $This = $(this);
$This.data('moving', false).removeClass('moving');
fOnEnd({
xStart: $This.data('x-start'),
yStart: $This.data('y-start'),
xEnd: $This.data('x-move'),
yEnd: $This.data('y-move')
});
if($This.data('moving')) {
$This.data('moving', false).removeClass('moving');
fOnEnd({
xStart: $This.data('x-start'),
yStart: $This.data('y-start'),
xEnd: $This.data('x-move'),
yEnd: $This.data('y-move')
});
}
});
};