diff --git a/src/main.css b/src/main.css index ce6126bd..47dd40c8 100644 --- a/src/main.css +++ b/src/main.css @@ -84,7 +84,7 @@ input, button, textarea, :focus { #current-time-display { text-align: center; - color: rgba(255, 255, 255, 0.3); + color: rgba(255, 255, 255, 0.8); padding: .5em; } @@ -94,22 +94,25 @@ input, button, textarea, :focus { background-color: #444; } -.timeline-wrapper .current-time, .timeline-wrapper .cut-start-time { +.timeline-wrapper .current-time, .timeline-wrapper .cut-section, .timeline-wrapper .cut-time-marker { position: absolute; bottom: 0; top: 0; - width: 1px; } -.timeline-wrapper .current-time { - background-color: red; - z-index: 2; -} -.timeline-wrapper .cut-start-time { - background-color: rgba(0, 0, 0, 0.3); - border-left: 1px solid black; - border-right: 1px solid black; +.timeline-wrapper .cut-section { z-index: 1; + background-color: rgba(0, 255, 149, 0.5); +} +.timeline-wrapper .cut-time-marker { + z-index: 2; + box-sizing: border-box; + background: rgba(0, 255, 149, 0.5); +} +.timeline-wrapper .current-time { + z-index: 3; + background-color: rgba(255, 255, 255, 1); + width: 1px; } #drag-drop-field { diff --git a/src/renderer.jsx b/src/renderer.jsx index 7d3bdaf5..1e2b35f9 100644 --- a/src/renderer.jsx +++ b/src/renderer.jsx @@ -68,7 +68,7 @@ const localState = { playing: false, currentTime: undefined, duration: undefined, - cutStartTime: 0, + cutStartTime: undefined, cutStartTimeManual: undefined, cutEndTime: undefined, cutEndTimeManual: undefined, @@ -274,6 +274,11 @@ class App extends React.Component { return `${this.getRotation()}°`; } + getApparentCutStartTime() { + if (this.state.cutStartTime !== undefined) return this.state.cutStartTime; + return 0; + } + getApparentCutEndTime() { if (this.state.cutEndTime !== undefined) return this.state.cutEndTime; if (this.state.duration !== undefined) return this.state.duration; @@ -302,7 +307,7 @@ class App extends React.Component { toggleKeyframeCut = () => this.setState(({ keyframeCut }) => ({ keyframeCut: !keyframeCut })); jumpCutStart = () => { - seekAbs(this.state.cutStartTime); + seekAbs(this.getApparentCutStartTime()); } jumpCutEnd = () => { @@ -314,7 +319,7 @@ class App extends React.Component { const $target = $('.timeline-wrapper'); const parentOffset = $target.offset(); const relX = e.srcEvent.pageX - parentOffset.left; - setCursor((relX / $target[0].offsetWidth) * this.state.duration); + setCursor((relX / $target[0].offsetWidth) * (this.state.duration || 0)); }, 200); /* eslint-enable react/sort-comp */ @@ -351,13 +356,13 @@ class App extends React.Component { } const { - cutStartTime, cutEndTime, filePath, customOutDir, fileFormat, duration, includeAllStreams, + cutEndTime, cutStartTime, filePath, customOutDir, fileFormat, duration, includeAllStreams, stripAudio, keyframeCut, } = this.state; const rotation = this.isRotationSet() ? this.getRotation() : undefined; - if (!this.isCutRangeValid()) { + if (!(this.isCutRangeValid() || cutEndTime === undefined || cutStartTime === undefined)) { errorToast('Start time must be before end time'); return; } @@ -368,7 +373,7 @@ class App extends React.Component { customOutDir, filePath, format: fileFormat, - cutFrom: cutStartTime, + cutFrom: this.getApparentCutStartTime(), cutTo: cutEndTime, cutToApparent: this.getApparentCutEndTime(), videoDuration: duration, @@ -430,7 +435,7 @@ class App extends React.Component { } isCutRangeValid() { - return this.state.cutStartTime < this.getApparentCutEndTime(); + return this.getApparentCutStartTime() < this.getApparentCutEndTime(); } toggleHelp() { @@ -463,7 +468,7 @@ class App extends React.Component { })); }; - const cutTime = type === 'start' ? this.state.cutStartTime : this.getApparentCutEndTime(); + const cutTime = type === 'start' ? this.getApparentCutStartTime() : this.getApparentCutEndTime(); return ( - {!this.state.filePath && ( + {!filePath && (