Clamp to 0 and 1
This commit is contained in:
1 parent
51b0cd81c8
commit
ca50f489c0
1 file changed
+2
-2
@@ -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 () {
|
||||
|
||||
Reference in new issue
Block a user