Skip to content

Commit 2d51efd

Browse files
DavidZhang73Jiahao Zhang
and
Jiahao Zhang
authored
🔖 Release V2.0.3 (#173)
* 🐛 fix #169 * 🔖 Release V2.0.3 Co-authored-by: Jiahao Zhang <[email protected]>
1 parent e528681 commit 2d51efd

File tree

3 files changed

+119
-98
lines changed

3 files changed

+119
-98
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vidat2",
33
"private": true,
4-
"version": "2.0.2",
4+
"version": "2.0.3",
55
"scripts": {
66
"dev": "vite",
77
"build": "vite build",

src/pages/annotation/ControlPanel.vue

+1-40
Original file line numberDiff line numberDiff line change
@@ -166,25 +166,14 @@
166166
v-model="preferenceStore.showPopup"
167167
label="Show Popup"
168168
/>
169-
<q-select
170-
class="q-my-md"
171-
label="Playback Rate"
172-
outlined
173-
dense
174-
options-dense
175-
emit-value
176-
map-options
177-
v-model="annotationStore.videoPlaybackRate"
178-
:options="videoPlaybackRateOptions"
179-
/>
180169
</q-item-section>
181170
</q-item>
182171
</div>
183172
</q-list>
184173
</template>
185174

186175
<script setup>
187-
import { computed, watch, ref } from 'vue'
176+
import { computed, watch } from 'vue'
188177
import { ObjectAnnotation, RegionAnnotation, SkeletonAnnotation } from '~/libs/annotationlib.js'
189178
import utils from '~/libs/utils.js'
190179
import { useAnnotationStore } from '~/store/annotation.js'
@@ -505,32 +494,4 @@ const handleBulkClear = () => {
505494
utils.notify('Bulk clear successful!', 'positive')
506495
})
507496
}
508-
509-
// options
510-
const videoPlaybackRateOptions = [
511-
{
512-
label: '0.5x',
513-
value: 0.5
514-
},
515-
{
516-
label: '0.75x',
517-
value: 0.75
518-
},
519-
{
520-
label: '1.0x',
521-
value: 1.0
522-
},
523-
{
524-
label: '1.25x',
525-
value: 1.25
526-
},
527-
{
528-
label: '1.5x',
529-
value: 1.5
530-
},
531-
{
532-
label: '2.0x',
533-
value: 2.0
534-
}
535-
]
536497
</script>

src/pages/annotation/KeyframePanel.vue

+117-57
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,106 @@
11
<template>
22
<div
3-
class="row justify-evenly items-center q-pt-lg"
4-
:class="{'q-pb-lg': $q.screen.lt.md}"
3+
class="row justify-between items-center q-pt-lg"
4+
:class="{'q-pb-lg q-px-lg': $q.screen.lt.md}"
55
>
6-
<q-btn-group flat>
7-
<q-btn
6+
<div>
7+
<q-btn-group flat>
8+
<q-btn
89
outline
910
:icon="isPaused ? 'play_arrow' : 'pause'"
1011
@click="handlePlayPause"
11-
>
12-
<q-tooltip>{{ isPaused ? 'play (p)' : 'pause (p)' }}</q-tooltip>
13-
</q-btn>
14-
<q-btn
12+
>
13+
<q-tooltip>{{ isPaused ? 'play (p)' : 'pause (p)' }}</q-tooltip>
14+
</q-btn>
15+
<q-btn
1516
outline
1617
icon="stop"
1718
:disabled="!showVideoPlayer"
1819
@click="handleStop"
19-
>
20-
<q-tooltip v-if="showVideoPlayer">stop</q-tooltip>
21-
</q-btn>
22-
<q-btn
20+
>
21+
<q-tooltip v-if="showVideoPlayer">stop</q-tooltip>
22+
</q-btn>
23+
<q-btn
2324
outline
2425
:icon="showEdit ? 'done' : 'edit'"
2526
@click="showEdit = !showEdit"
26-
>
27-
<q-tooltip>{{ showEdit ? 'done' : 'edit' }}</q-tooltip>
28-
</q-btn>
29-
</q-btn-group>
27+
>
28+
<q-tooltip>{{ showEdit ? 'done' : 'edit' }}</q-tooltip>
29+
</q-btn>
30+
</q-btn-group>
31+
<q-select
32+
v-if="!$q.screen.lt.md"
33+
class="q-my-md"
34+
label="Playback Rate"
35+
outlined
36+
dense
37+
options-dense
38+
emit-value
39+
map-options
40+
:disable="!isStopped"
41+
v-model="annotationStore.videoPlaybackRate"
42+
:options="videoPlaybackRateOptions"
43+
/>
44+
</div>
45+
<q-select
46+
v-if="$q.screen.lt.md"
47+
class="q-my-md"
48+
style="width: 162px;"
49+
label="Playback Rate"
50+
outlined
51+
dense
52+
options-dense
53+
emit-value
54+
map-options
55+
:disable="!isStopped"
56+
v-model="annotationStore.videoPlaybackRate"
57+
:options="videoPlaybackRateOptions"
58+
/>
3059
<div
31-
class="col-grow q-px-lg"
32-
:class="[{'col-12': $q.screen.lt.md}]"
33-
:style="{'order': !$q.screen.lt.md ? 0 : -1}"
60+
class="col-grow"
61+
:class="[{'col-12': $q.screen.lt.md, 'q-px-lg': !$q.screen.lt.md}]"
62+
:style="{'order': !$q.screen.lt.md ? 0 : -1}"
3463
>
3564
<q-range
36-
class="custom-range"
37-
:class="{'hide-right-marker': currentFocus === 'left', 'hide-left-marker': currentFocus === 'right'}"
38-
:style="rangeStyle"
39-
label-always
40-
drag-range
41-
snap
42-
track-size="8px"
43-
:min="0"
44-
:max="annotationStore.video.frames - 1"
45-
:step="1"
46-
left-label-text-color="blue-grey-1"
47-
right-label-text-color="blue-grey-1"
48-
left-label-color="primary"
49-
right-label-color="primary"
50-
:left-label-value="'L: ' + currentFrameRange.min + ' | ' + utils.toFixed2(utils.index2time(currentFrameRange.min)) + ' s'"
51-
:right-label-value="'R: ' + currentFrameRange.max + ' | ' + utils.toFixed2(utils.index2time(currentFrameRange.max)) + ' s'"
52-
:model-value="currentFrameRange"
53-
@update:model-value="handleInput"
65+
class="custom-range"
66+
:class="{'hide-right-marker': currentFocus === 'left', 'hide-left-marker': currentFocus === 'right'}"
67+
:style="rangeStyle"
68+
label-always
69+
drag-range
70+
snap
71+
track-size="8px"
72+
:min="0"
73+
:max="annotationStore.video.frames - 1"
74+
:step="1"
75+
left-label-text-color="blue-grey-1"
76+
right-label-text-color="blue-grey-1"
77+
left-label-color="primary"
78+
right-label-color="primary"
79+
:left-label-value="'L: ' + currentFrameRange.min + ' | ' + utils.toFixed2(utils.index2time(currentFrameRange.min)) + ' s'"
80+
:right-label-value="'R: ' + currentFrameRange.max + ' | ' + utils.toFixed2(utils.index2time(currentFrameRange.max)) + ' s'"
81+
:model-value="currentFrameRange"
82+
@update:model-value="handleInput"
5483
/>
5584
</div>
5685
<q-btn-group flat>
5786
<q-btn
58-
outline
59-
icon="keyboard_arrow_left"
60-
@click="handlePreviousKeyframe"
87+
outline
88+
icon="keyboard_arrow_left"
89+
@click="handlePreviousKeyframe"
6190
>
6291
<q-tooltip>previous keyframe (&lt)</q-tooltip>
6392
</q-btn>
6493
<q-btn
65-
outline
66-
icon="gps_fixed"
67-
@click="handleNearestKeyframe"
94+
outline
95+
icon="gps_fixed"
96+
@click="handleNearestKeyframe"
6897
>
6998
<q-tooltip>locate nearest keyframe</q-tooltip>
7099
</q-btn>
71100
<q-btn
72-
outline
73-
icon="keyboard_arrow_right"
74-
@click="handleNextKeyframe"
101+
outline
102+
icon="keyboard_arrow_right"
103+
@click="handleNextKeyframe"
75104
>
76105
<q-tooltip>next keyframe (&gt)</q-tooltip>
77106
</q-btn>
@@ -91,6 +120,7 @@ const annotationStore = useAnnotationStore()
91120
92121
// left buttons
93122
const isPaused = ref(true)
123+
const isStopped = ref(true)
94124
const showVideoPlayer = ref(false)
95125
const showEdit = ref(false)
96126
let videoPlayTimeout
@@ -100,10 +130,11 @@ let lastLeftCurrentFrame
100130
const play = () => {
101131
const videoPlayer = document.getElementById('video-player')
102132
isPaused.value = false
133+
isStopped.value = false
103134
videoPlayer.playbackRate = annotationStore.videoPlaybackRate
104135
videoPlayer.play()
105136
const duration = (utils.index2time(annotationStore.rightCurrentFrame) - videoPlayer.currentTime) * 1000 /
106-
videoPlayer.playbackRate
137+
videoPlayer.playbackRate
107138
videoPlayTimeout = setTimeout(() => {
108139
handleStop()
109140
}, duration)
@@ -125,6 +156,7 @@ const stop = () => {
125156
videoPlayer.currentTime = utils.index2time(lastLeftCurrentFrame)
126157
showVideoPlayer.value = false
127158
isPaused.value = true
159+
isStopped.value = true
128160
clearTimeout(videoPlayTimeout)
129161
clearInterval(videoPlayInterval)
130162
}
@@ -149,6 +181,34 @@ const handleStop = () => {
149181
annotationStore.leftCurrentFrame = lastLeftCurrentFrame
150182
}
151183
184+
// options
185+
const videoPlaybackRateOptions = [
186+
{
187+
label: '0.5x',
188+
value: 0.5,
189+
},
190+
{
191+
label: '0.75x',
192+
value: 0.75,
193+
},
194+
{
195+
label: '1.0x',
196+
value: 1.0,
197+
},
198+
{
199+
label: '1.25x',
200+
value: 1.25,
201+
},
202+
{
203+
label: '1.5x',
204+
value: 1.5,
205+
},
206+
{
207+
label: '2.0x',
208+
value: 2.0,
209+
},
210+
]
211+
152212
// right buttons
153213
const nearestKeyframe = currentFrame => {
154214
let min = annotationStore.video.frames
@@ -197,7 +257,7 @@ const handleNearestKeyframe = () => {
197257
} else {
198258
annotationStore.leftCurrentFrame = leftCurrentKeyFrame
199259
annotationStore.rightCurrentFrame = annotationStore.keyframeList[leftCurrentKeyFrameIndex + 1] ||
200-
leftCurrentKeyFrame
260+
leftCurrentKeyFrame
201261
}
202262
}
203263
const handleNextKeyframe = () => { // base on left most one
@@ -208,17 +268,17 @@ const handleNextKeyframe = () => { // base on left most one
208268
const lastIndex = annotationStore.keyframeList.length - 1
209269
if (leftCurrentKeyFrameIndex >= lastIndex || rightCurrentKeyFrameIndex >= lastIndex) {
210270
annotationStore.leftCurrentFrame = lastIndex - 1 >= 0
211-
? annotationStore.keyframeList[lastIndex - 1]
212-
: annotationStore.keyframeList[lastIndex]
271+
? annotationStore.keyframeList[lastIndex - 1]
272+
: annotationStore.keyframeList[lastIndex]
213273
annotationStore.rightCurrentFrame = annotationStore.keyframeList[lastIndex]
214274
} else if (leftCurrentKeyFrameIndex === rightCurrentKeyFrameIndex) {
215275
annotationStore.leftCurrentFrame = leftCurrentKeyFrame
216276
annotationStore.rightCurrentFrame = annotationStore.keyframeList[leftCurrentKeyFrameIndex + 1]
217277
} else if (leftCurrentKeyFrameIndex < rightCurrentKeyFrameIndex) {
218278
if (leftCurrentKeyFrameIndex + 2 > lastIndex) {
219279
annotationStore.leftCurrentFrame = lastIndex - 1 >= 0
220-
? annotationStore.keyframeList[lastIndex - 1]
221-
: annotationStore.keyframeList[lastIndex]
280+
? annotationStore.keyframeList[lastIndex - 1]
281+
: annotationStore.keyframeList[lastIndex]
222282
annotationStore.rightCurrentFrame = annotationStore.keyframeList[lastIndex]
223283
} else {
224284
annotationStore.leftCurrentFrame = annotationStore.keyframeList[leftCurrentKeyFrameIndex + 1]
@@ -263,7 +323,7 @@ const moveRange = interval => {
263323
}
264324
} else {
265325
if (Math.max(annotationStore.leftCurrentFrame, annotationStore.rightCurrentFrame) + interval
266-
<= annotationStore.video.frames) {
326+
<= annotationStore.video.frames) {
267327
annotationStore.leftCurrentFrame += interval
268328
annotationStore.rightCurrentFrame += interval
269329
}
@@ -319,14 +379,14 @@ const handleKeydown = event => {
319379
currentFocus.value = {
320380
left: 'right',
321381
range: 'left',
322-
right: 'range'
382+
right: 'range',
323383
}[currentFocus.value]
324384
event.preventDefault()
325385
} else if (event.code === 'ArrowDown') {
326386
currentFocus.value = {
327387
left: 'range',
328388
range: 'right',
329-
right: 'left'
389+
right: 'left',
330390
}[currentFocus.value]
331391
event.preventDefault()
332392
} else if (event.code === 'PageUp') {
@@ -369,7 +429,7 @@ const currentFrameRange = computed({
369429
get: () => {
370430
return {
371431
min: annotationStore.leftCurrentFrame,
372-
max: annotationStore.rightCurrentFrame
432+
max: annotationStore.rightCurrentFrame,
373433
}
374434
},
375435
set: (value) => {
@@ -378,7 +438,7 @@ const currentFrameRange = computed({
378438
}
379439
annotationStore.leftCurrentFrame = value.min
380440
annotationStore.rightCurrentFrame = value.max
381-
}
441+
},
382442
})
383443
const { rangeStyle } = frameIndicator()
384444
</script>

0 commit comments

Comments
 (0)