Skip to content

Commit

Permalink
fix mobile and max-height
Browse files Browse the repository at this point in the history
  • Loading branch information
fadri1 committed Jul 7, 2021
1 parent 692f733 commit e13e52c
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 52 deletions.
37 changes: 20 additions & 17 deletions dist/dnm-react-video-cut.es.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/dnm-react-video-cut.es.min.js

Large diffs are not rendered by default.

37 changes: 20 additions & 17 deletions dist/dnm-react-video-cut.umd.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/dnm-react-video-cut.umd.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": "dnm-react-video-cut",
"version": "1.2.4",
"version": "1.2.5",
"description": "",
"main": "dist/dnm-react-video-cut.umd.min.js",
"module": "dist/dnm-react-video-cut.es.min.js",
Expand Down
21 changes: 15 additions & 6 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class DnmVideoCut extends React.Component {
this.scrollable = React.createRef();
this.draggable = React.createRef();
this.draggableApi = null;
this.seekVideoTo = throttle(this._seekVideoTo, 50);
this.seekVideoTo = throttle(this._seekVideoTo, 20);
}

componentDidMount() {
Expand Down Expand Up @@ -264,9 +264,10 @@ export default class DnmVideoCut extends React.Component {
handleContainerMouseDown = (ev) => {
ev.stopPropagation();
const { target } = ev;
const { rangeDisabled, forceCursorDragging } = this.state;
if(!target.classList.contains("rc-slider-handle") && !target.classList.contains("dnm-video-cut-playing-cursor")) {
this.setState({ rangeDisabled: true, forceCursorDragging: true });
} else this.setState({ rangeDisabled: false, forceCursorDragging: false });
if (!rangeDisabled || !forceCursorDragging) this.setState({ rangeDisabled: true, forceCursorDragging: true });
} else if (rangeDisabled || forceCursorDragging) this.setState({ rangeDisabled: false, forceCursorDragging: false });
}

handleContainerMouseUp = () => this.setState({ rangeDisabled: true, forceCursorDragging: false });
Expand All @@ -278,12 +279,12 @@ export default class DnmVideoCut extends React.Component {

render() {
const { inValue, outValue } = this.getFormatedValues();
const { videoDuration, isEditing, playCursorPosition, isPlaying, forceCursorDragging, zoomFactor, } = this.state;
const { videoDuration, playCursorPosition, isPlaying, forceCursorDragging, zoomFactor, } = this.state;
const { src, catalogue, classes, playerCursorWidth, muted, onMuteChange, } = this.props;

return (
<div css={css`${styles}`}>
<div className={`dnm-video-cut-root ${classes.root || ""} ${isEditing ? "is-editing" : ""} ${isPlaying ? "is-playing" : "is-paused"}`}>
<div className={`dnm-video-cut-root ${classes.root || ""} ${isPlaying ? "is-playing" : "is-paused"}`}>
<video
className={`dnm-video-cut-player ${classes.player || ""}`}
src={`${src}`}
Expand All @@ -294,13 +295,21 @@ export default class DnmVideoCut extends React.Component {
onLoadedData={this.handleLoadedData}
onLoad={this.handleVideoLoad}
onError={this.handleVideoPlayerError}
preload="auto"
/>
<div>
<div className="dnm-video-cut-play-icon" onClick={this.handleFreePlayClick}>
{isPlaying ? <PauseIcon /> : <PlayIcon /> }
</div>
<div className="dnm-video-cut-progress-scrollable-parent" ref={this.scrollable}>
<div className="dnm-video-cut-progress-container" style={{ width: `calc(${zoomFactor[0] + 100}% - 20px)` }} onTouchStart={this.handleContainerMouseDown} onTouchEnd={this.handleContainerMouseUp} onMouseDown={this.handleContainerMouseDown} onMouseUp={this.handleContainerMouseUp}>
<div
className="dnm-video-cut-progress-container"
style={{ width: `calc(${zoomFactor[0] + 100}% - 20px)` }}
onTouchMove={this.handleContainerMouseDown}
onTouchEnd={this.handleContainerMouseUp}
onMouseDown={this.handleContainerMouseDown}
onMouseUp={this.handleContainerMouseUp}
>
<Draggable
className="dnm-video-cut-playing-cursor-draggable-item"
axis="x"
Expand Down
8 changes: 1 addition & 7 deletions src/css/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,12 @@ export default css`
}
.dnm-video-cut-player {
transform: scale(1);
opacity: 1;
width: 100%;
max-height: 60vh;
transition: all 0.2s ease-in-out;
}
.dnm-video-cut-root.is-editing .dnm-video-cut-player {
transform: scale(0.9);
opacity: 0.8;
box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.5);
}
.dnm-video-cut-range {
width: 100%;
position: relative;
Expand Down

0 comments on commit e13e52c

Please sign in to comment.