Skip to content

Commit 058d328

Browse files
committed
refactor segment management logic for video duration and playback position, fixed control button height, set default clip selection to full length of video
1 parent 535b461 commit 058d328

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
display: flex;
8888
align-items: center;
8989
gap: 10px;
90+
height: 100%;
9091
-webkit-app-region: no-drag;
91-
margin-right: 4px;
9292
}
9393

9494
.gpu-badge {

js/controller.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ function loadVideo(filePath) {
201201
el.fps30Toggle.disabled = false;
202202
}
203203

204-
// Auto-add first segment (first 10s or full duration)
205-
addSegment(0, Math.min(10, appState.videoDuration));
204+
// Auto-add first segment covering the full video duration
205+
addSegment(0, appState.videoDuration);
206206
};
207207

208208
el.videoPlayer.ontimeupdate = () => {
@@ -262,10 +262,15 @@ function setupVideoControls() {
262262
function setupSegmentControls() {
263263
el.addSegmentBtn.addEventListener('click', () => {
264264
if (!appState.videoPath) return;
265-
// Default new segment starts at current playback position
266-
const cur = el.videoPlayer.currentTime || 0;
267-
const end = Math.min(cur + 10, appState.videoDuration);
268-
addSegment(cur, end, 1);
265+
// If segments exist, start new segment at the end of the last one
266+
let start;
267+
if (appState.segments.length > 0) {
268+
start = appState.segments[appState.segments.length - 1].endTime;
269+
} else {
270+
start = el.videoPlayer.currentTime || 0;
271+
}
272+
const end = Math.min(start + 10, appState.videoDuration);
273+
addSegment(start, end, 1);
269274
});
270275

271276
// "From Here" — sets start of last segment (or creates one) to current time

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dta-cutter",
3-
"version": "2.0.8",
3+
"version": "2.0.9",
44
"description": "A simple video cutter for gaming clips with multi-segment support",
55
"main": "main.js",
66
"scripts": {

0 commit comments

Comments
 (0)