Skip to content

Commit

Permalink
fix issue with dragging file items
Browse files Browse the repository at this point in the history
  • Loading branch information
rikschennink committed Apr 12, 2024
1 parent 84b6216 commit 3954d61
Show file tree
Hide file tree
Showing 11 changed files with 143 additions and 110 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ coverage/
.idea
.vscode/
upload/
test.html
test.html
_TODO.md
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 4.31.1

- Fix issue with dragging file items sometimes not working.

## 4.31.0

- Add support for editing mock files if `item.source` is url.
Expand Down
4 changes: 3 additions & 1 deletion dist/filepond.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* FilePond 4.31.0
* FilePond 4.31.1
* Licensed under MIT, https://opensource.org/licenses/MIT/
* Please visit https://pqina.nl/filepond/ for details.
*/
Expand Down Expand Up @@ -632,6 +632,8 @@

will-change: transform, opacity;

touch-action: none;

/* item children order */
}
.filepond--item > .filepond--panel {
Expand Down
18 changes: 14 additions & 4 deletions dist/filepond.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* FilePond 4.31.0
* FilePond 4.31.1
* Licensed under MIT, https://opensource.org/licenses/MIT/
* Please visit https://pqina.nl/filepond/ for details.
*/
Expand Down Expand Up @@ -6079,14 +6079,23 @@ const create$7 = ({ root, props }) => {
const drop = e => {
if (!e.isPrimary) return;

document.removeEventListener('pointermove', drag);
document.removeEventListener('pointerup', drop);

props.dragOffset = {
x: e.pageX - origin.x,
y: e.pageY - origin.y,
};

reset();
};

const cancel = () => {
reset();
};

const reset = () => {
document.removeEventListener('pointercancel', cancel);
document.removeEventListener('pointermove', drag);
document.removeEventListener('pointerup', drop);

root.dispatch('DID_DROP_ITEM', { id: props.id, dragState });

// start listening to clicks again
Expand All @@ -6095,6 +6104,7 @@ const create$7 = ({ root, props }) => {
}
};

document.addEventListener('pointercancel', cancel);
document.addEventListener('pointermove', drag);
document.addEventListener('pointerup', drop);
};
Expand Down
4 changes: 2 additions & 2 deletions dist/filepond.esm.min.js

Large diffs are not rendered by default.

23 changes: 16 additions & 7 deletions dist/filepond.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* FilePond 4.31.0
* FilePond 4.31.1
* Licensed under MIT, https://opensource.org/licenses/MIT/
* Please visit https://pqina.nl/filepond/ for details.
*/
Expand Down Expand Up @@ -8549,7 +8549,6 @@
var create$7 = function create(_ref) {
var root = _ref.root,
props = _ref.props;

// select
root.ref.handleClick = function(e) {
return root.dispatch('DID_ACTIVATE_ITEM', { id: props.id });
Expand Down Expand Up @@ -8629,14 +8628,23 @@
var drop = function drop(e) {
if (!e.isPrimary) return;

document.removeEventListener('pointermove', drag);
document.removeEventListener('pointerup', drop);

props.dragOffset = {
x: e.pageX - origin.x,
y: e.pageY - origin.y,
};

reset();
};

var cancel = function cancel() {
reset();
};

var reset = function reset() {
document.removeEventListener('pointercancel', cancel);
document.removeEventListener('pointermove', drag);
document.removeEventListener('pointerup', drop);

root.dispatch('DID_DROP_ITEM', { id: props.id, dragState: dragState });

// start listening to clicks again
Expand All @@ -8647,6 +8655,7 @@
}
};

document.addEventListener('pointercancel', cancel);
document.addEventListener('pointermove', drag);
document.addEventListener('pointerup', drop);
};
Expand Down Expand Up @@ -8684,12 +8693,12 @@
root.element.dataset.dragState = 'drop';
},
},

function(_ref6) {
var root = _ref6.root,
actions = _ref6.actions,
props = _ref6.props,
shouldOptimize = _ref6.shouldOptimize;

if (root.element.dataset.dragState === 'drop') {
if (root.scaleX <= 1) {
root.element.dataset.dragState = 'idle';
Expand Down Expand Up @@ -8758,8 +8767,8 @@
'dragOrigin',
'dragOffset',
],
styles: ['translateX', 'translateY', 'scaleX', 'scaleY', 'opacity', 'height'],

styles: ['translateX', 'translateY', 'scaleX', 'scaleY', 'opacity', 'height'],
animations: {
scaleX: ITEM_SCALE_SPRING,
scaleY: ITEM_SCALE_SPRING,
Expand Down
4 changes: 2 additions & 2 deletions dist/filepond.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/filepond.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "filepond",
"version": "4.31.0",
"version": "4.31.1",
"description": "FilePond, Where files go to stretch their bits.",
"license": "MIT",
"author": {
Expand Down
2 changes: 2 additions & 0 deletions src/css/item.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

will-change: transform, opacity;

touch-action: none;

/* item children order */
& > .filepond--panel {
z-index: -1;
Expand Down
Loading

0 comments on commit 3954d61

Please sign in to comment.