Skip to content

Commit 0d2477e

Browse files
committed
Optimise resize
1 parent 968eb05 commit 0d2477e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

react-spaces/src/Resizable.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ export const Resizable : React.FC<IProps> = (props) => {
5757
throttledTouchResize(lastX, lastY);
5858
};
5959
const removeListener = () => {
60-
touchResize(lastX, lastY);
60+
if (moved) {
61+
touchResize(lastX, lastY);
62+
}
6163
resizing = false;
6264
window.removeEventListener('touchmove', withPreventDefault);
6365
window.removeEventListener('touchend', removeListener);
@@ -89,7 +91,9 @@ export const Resizable : React.FC<IProps> = (props) => {
8991
throttledMouseResize(lastX, lastY);
9092
};
9193
const removeListener = () => {
92-
mouseResize(lastX, lastY);
94+
if (moved) {
95+
mouseResize(lastX, lastY);
96+
}
9397
resizing = false;
9498
window.removeEventListener('mousemove', withPreventDefault);
9599
window.removeEventListener('mouseup', removeListener);

0 commit comments

Comments
 (0)