Skip to content

Commit

Permalink
Don't throttle event prevention
Browse files Browse the repository at this point in the history
  • Loading branch information
nomcopter committed Jun 18, 2019
1 parent bd4864b commit 64b9d49
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Split.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ export class Split extends React.PureComponent<SplitProps> {
this.props.onRelease!(percentage);
};

private onMouseMove = throttle((event: MouseEvent | TouchEvent) => {
private onMouseMove = (event: MouseEvent | TouchEvent) => {
event.preventDefault();
event.stopPropagation();

this.throttledUpdatePercentage(event);
};

private throttledUpdatePercentage = throttle((event: MouseEvent | TouchEvent) => {
const percentage = this.calculateRelativePercentage(event);
if (percentage !== this.props.splitPercentage) {
this.props.onChange!(percentage);
Expand Down

0 comments on commit 64b9d49

Please sign in to comment.