diff --git a/app/css/app.css b/app/css/app.css index 508f0e1..306b497 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -829,6 +829,21 @@ button:focus { color: #fff; text-shadow: 1px 1px 2px #000; } +#spinnerCancel { + display: none; + position: absolute; + z-index: 2000000000; + left: 50%; + top: 50%; + text-align: center; + margin-left: -40%; + margin-top: 120px; + width: 80%; +} +#spinnerCancel .btn { + margin: 0 auto; + background: rgba(80, 80, 80, 0.4); +} .cp-app { position: relative !important; border-radius: 0px !important; diff --git a/app/index.html b/app/index.html index cb5de6b..acaee26 100644 --- a/app/index.html +++ b/app/index.html @@ -302,10 +302,14 @@
+
+
Cancel
+
0% Complete
+
diff --git a/app/less/app.less b/app/less/app.less index fd02392..8ca25f8 100644 --- a/app/less/app.less +++ b/app/less/app.less @@ -158,6 +158,22 @@ text-shadow: 1px 1px 2px #000; } +#spinnerCancel{ + display:none; + position: absolute; + z-index: 2000000000; + left: 50%; + top: 50%; + text-align: center; + margin-left: -40%; + margin-top: 120px; + width: 80%; + .btn{ + margin: 0 auto; + background: rgba(80,80,80, 0.4); + } +} + .cp-app{ position: relative !important; border-radius: 0px !important; diff --git a/app/lib/ui/cmd.js b/app/lib/ui/cmd.js index 17febcc..4491d67 100644 --- a/app/lib/ui/cmd.js +++ b/app/lib/ui/cmd.js @@ -192,6 +192,12 @@ cmd.black_backward = function (callback) { }, mcopy.cfg.arduino.serialDelay); } }; +/** + * Move the camera to a specific frame. Accepts the input with the "move_cam_to" + * value. Moves as black frames to prevent multiple exposure. + * + * @param {object} t HTML input element with the move to val + **/ cmd.cam_to = function (t) { const raw = $('#move_cam_to').val(); const val = parseInt(raw); diff --git a/app/lib/ui/index.js b/app/lib/ui/index.js index 73700e8..e9d9cbd 100644 --- a/app/lib/ui/index.js +++ b/app/lib/ui/index.js @@ -106,7 +106,7 @@ gui.spinnerCfg = { top: '50%', // Top position relative to parent left: '50%' // Left position relative to parent }; -gui.spinner = function (state, msg, progress) { +gui.spinner = function (state, msg, progress, cancel) { 'use strict'; let target; let spinner; @@ -128,6 +128,11 @@ gui.spinner = function (state, msg, progress) { if (progress) { gui.spinnerProgress(progress); } + if (cancel) { + $('#spinnerCancel').show(); + } else { + $('#spinnerCancel').hide(); + } }; gui.spinnerMsg = function (msg) { 'use strict'; diff --git a/app/lib/ui/seq.js b/app/lib/ui/seq.js index a67785a..1029ad3 100644 --- a/app/lib/ui/seq.js +++ b/app/lib/ui/seq.js @@ -241,11 +241,16 @@ seq.exec = function (arr) { seq.queue = arr; //console.dir(arr); gui.overlay(true); - gui.spinner(true, `Running sequence of ${arr.length} frame${(arr.length === 1 ? '' : 's')}`, 0); + gui.spinner(true, `Running sequence of ${arr.length} frame${(arr.length === 1 ? '' : 's')}`, 0, true); log.info(`Sequence started`, 'SEQUENCE', true); seq.step(); }; +seq.cancel = function () { + gui.spinner(true, `Cancelling sequence...`); + seq.running = false; +} + seq.execStop = function (msg) { 'use strict'; gui.overlay(false); @@ -281,7 +286,7 @@ seq.step = function () { if (typeof elem !== 'undefined') { current = seq.state.len - seq.queue.length; max = seq.state.len; - gui.spinner(true, `Sequence: step ${c} ${current}/${max}`, (current / max) * 100); + gui.spinner(true, `Sequence: step ${c} ${current}/${max}`, (current / max) * 100, true); log.info(`Sequence: step ${c} ${current}/${max}`, 'SEQUENCE', true); if (c === 'CF'){ cmd.cam_forward(rgb, seq.step);