@@ -115,6 +115,7 @@ export default {
115
115
this .$store .commit (' toggleDrawer' , ! currentStatus)
116
116
},
117
117
move : function (direction ) {
118
+ this .$data .pressDuration = performance .now ()
118
119
console .log (" move" )
119
120
let axios = this .$axios
120
121
let CB = this .$data .CB
@@ -164,11 +165,27 @@ export default {
164
165
console .log (" stopping" )
165
166
let axios = this .$axios
166
167
let CB = this .$data .CB
167
- axios .post (CB + ' /stop' ).then (function (response ) {
168
- console .log (response)
169
- }).catch (function (error ) {
170
- console .log (error)
171
- })
168
+ let pressDuration = this .$data .pressDuration
169
+ pressDuration = performance .now () - this .$data .pressDuration
170
+ let minTreshold = 500
171
+ let delay = minTreshold - pressDuration
172
+ console .log (" Pressed for" , pressDuration, " ms" )
173
+ if (pressDuration < 500 ){
174
+ console .log (" Too fast, postponing it by" , delay ," ms.." )
175
+ setTimeout (function () {
176
+ axios .post (CB + ' /stop' ).then (function (response ) {
177
+ console .log (response)
178
+ }).catch (function (error ) {
179
+ console .log (error)
180
+ })
181
+ }, delay );
182
+ } else {
183
+ axios .post (CB + ' /stop' ).then (function (response ) {
184
+ console .log (response)
185
+ }).catch (function (error ) {
186
+ console .log (error)
187
+ })
188
+ }
172
189
}
173
190
},
174
191
data () {
@@ -178,6 +195,7 @@ export default {
178
195
webcamStream: process .env .CB_ENDPOINT + process .env .APIv1 + ' /video/stream' ,
179
196
CB : process .env .CB_ENDPOINT + process .env .APIv2 ,
180
197
status: null ,
198
+ pressDuration: null ,
181
199
};
182
200
},
183
201
mounted () {
0 commit comments