1
1
<script lang="ts">
2
2
import {
3
3
defineComponent , ref , PropType , computed , watch ,
4
+ Ref ,
5
+ reactive ,
4
6
} from ' vue' ;
5
7
import type { DatasetType } from ' dive-common/apispec' ;
6
8
import FileNameTimeDisplay from ' vue-media-annotator/components/controls/FileNameTimeDisplay.vue' ;
@@ -11,6 +13,7 @@ import {
11
13
LineChart ,
12
14
Timeline ,
13
15
} from ' vue-media-annotator/components' ;
16
+ import { clientSettings } from ' dive-common/store/settings' ;
14
17
import { useAttributesFilters , useCameraStore , useSelectedCamera } from ' ../../src/provides' ;
15
18
16
19
export default defineComponent ({
@@ -49,6 +52,13 @@ export default defineComponent({
49
52
const cameraStore = useCameraStore ();
50
53
const multiCam = ref (cameraStore .camMap .value .size > 1 );
51
54
const selectedCamera = useSelectedCamera ();
55
+ const activeCountSettings = ref (false );
56
+ const countView: Ref <' tracks' | ' detections' > = ref (clientSettings .timelineCountSettings .defaultView );
57
+ const help = reactive ({
58
+ countType: ' Swap between counting tracks vs counting detections' ,
59
+ showTotal: ' In the graph show a line for the total counts' ,
60
+ });
61
+
52
62
const hasGroups = computed (
53
63
() => !! cameraStore .camMap .value .get (selectedCamera .value )?.groupStore .sorted .value .length ,
54
64
);
@@ -84,6 +94,16 @@ export default defineComponent({
84
94
toggleView (' Events' );
85
95
}
86
96
});
97
+
98
+ const toggleCountView = () => {
99
+ if (countView .value === ' detections' ) {
100
+ countView .value = ' tracks' ;
101
+ } else {
102
+ countView .value = ' detections' ;
103
+ }
104
+ clientSettings .timelineCountSettings .defaultView = countView .value ;
105
+ };
106
+
87
107
const {
88
108
maxFrame, frame, seek, volume, setVolume, setSpeed, speed,
89
109
} = injectAggregateController ().value ;
@@ -102,6 +122,11 @@ export default defineComponent({
102
122
hasGroups ,
103
123
attributeData ,
104
124
timelineEnabled ,
125
+ activeCountSettings ,
126
+ clientSettings ,
127
+ countView ,
128
+ help ,
129
+ toggleCountView ,
105
130
};
106
131
},
107
132
});
@@ -130,17 +155,102 @@ export default defineComponent({
130
155
</template >
131
156
<span >Collapse/Expand Timeline</span >
132
157
</v-tooltip >
133
- <v-btn
134
- class =" ml-1"
135
- :class =" { 'timeline-button': currentView !== 'Detections' || collapsed }"
136
- depressed
137
- :outlined =" currentView === 'Detections' && !collapsed"
138
- x-small
139
- tab-index =" -1"
140
- @click =" toggleView('Detections')"
158
+
159
+ <v-menu
160
+ v-model =" activeCountSettings"
161
+ :nudge-top =" 28"
162
+ top
163
+ :close-on-content-click =" false"
164
+ open-on-hover
165
+ open-delay =" 750"
166
+ close-delay =" 500"
141
167
>
142
- Detections
143
- </v-btn >
168
+ <template #activator =" { on , attrs } " >
169
+ <v-btn
170
+ class =" ml-1"
171
+ :class =" { 'timeline-button': currentView !== 'Detections' || collapsed }"
172
+ depressed
173
+ :outlined =" currentView === 'Detections' && !collapsed"
174
+ x-small
175
+ tab-index =" -1"
176
+ v-bind =" attrs"
177
+ v-on =" on"
178
+ @click =" toggleView('Detections')"
179
+ >
180
+ <span class =" mr-1" ># of</span >{{ countView }}
181
+ </v-btn >
182
+ </template >
183
+ <v-card
184
+ outlined
185
+ class =" pa-2 pr-4"
186
+ color =" blue-grey darken-3"
187
+ style =" overflow-y : none "
188
+ >
189
+ <v-card-title >
190
+ Count Settings
191
+ </v-card-title >
192
+ <v-card-text >
193
+ <v-row >
194
+ <v-col class =" py-1" >
195
+ <v-btn small @click =" toggleCountView()" >
196
+ Swap to {{ countView === 'detections' ? 'Tracks' : 'Detections' }}
197
+ </v-btn >
198
+ </v-col >
199
+ <v-col
200
+ cols =" 2"
201
+ class =" py-1"
202
+ align =" right"
203
+ >
204
+ <v-tooltip
205
+ open-delay =" 200"
206
+ bottom
207
+ >
208
+ <template #activator =" { on } " >
209
+ <v-icon
210
+ small
211
+ v-on =" on"
212
+ >
213
+ mdi-help
214
+ </v-icon >
215
+ </template >
216
+ <span >{{ help.countType }}</span >
217
+ </v-tooltip >
218
+ </v-col >
219
+ </v-row >
220
+ <v-row >
221
+ <v-col class =" py-1" >
222
+ <v-switch
223
+ v-model =" clientSettings.timelineCountSettings.totalCount"
224
+ label =" Show Total Count"
225
+ class =" my-0 ml-1 pt-0"
226
+ dense
227
+ hide-details
228
+ />
229
+ </v-col >
230
+ <v-col
231
+ cols =" 2"
232
+ class =" py-1"
233
+ align =" right"
234
+ >
235
+ <v-tooltip
236
+ open-delay =" 200"
237
+ bottom
238
+ >
239
+ <template #activator =" { on } " >
240
+ <v-icon
241
+ small
242
+ v-on =" on"
243
+ >
244
+ mdi-help
245
+ </v-icon >
246
+ </template >
247
+ <span >{{ help.showTotal }}</span >
248
+ </v-tooltip >
249
+ </v-col >
250
+ </v-row >
251
+ </v-card-text >
252
+ </v-card >
253
+ </v-menu >
144
254
<v-btn
145
255
class =" ml-1"
146
256
:class =" { 'timeline-button': currentView !== 'Events' || collapsed }"
0 commit comments