Clamp to 0 and 1

This commit is contained in:
Paul Kaplan committed 2017-07-10 08:55:55 -04:00
1 parent 51b0cd81c8
commit ca50f489c0
1 file changed
+2 -2
+2 -2
View File
@@ -18,13 +18,13 @@ class AudioTrimmer extends React.Component {
handleTrimStartMouseMove (e) {
const containerSize = this.containerElement.getBoundingClientRect().width;
const dx = (e.clientX - this.initialX) / containerSize;
const newTrim = Math.max(0.01, Math.min(this.props.trimEnd, this.initialTrim + dx));
const newTrim = Math.max(0, Math.min(this.props.trimEnd, this.initialTrim + dx));
this.props.onSetTrimStart(newTrim);
}
handleTrimEndMouseMove (e) {
const containerSize = this.containerElement.getBoundingClientRect().width;
const dx = (e.clientX - this.initialX) / containerSize;
const newTrim = Math.min(0.99, Math.max(this.props.trimStart, this.initialTrim + dx));
const newTrim = Math.min(1, Math.max(this.props.trimStart, this.initialTrim + dx));
this.props.onSetTrimEnd(newTrim);
}
handleTrimStartMouseUp () {