Skip to content

Commit 11910e6

Browse files
committed
feature: make Remotebuzzer available on chroma capture
Change-Id: I1d7b8617af44e18db0da61fee13d5360dbabfd15
1 parent 63c2b24 commit 11910e6

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

assets/js/remotebuzzer-client.js

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -218,39 +218,44 @@ function initRemoteBuzzerFromDOM() {
218218
// vars
219219
const api = {};
220220
api.waitingToProcessCollage = false;
221+
api.needsReload = false;
222+
api.chromaCapture = typeof onCaptureChromaView !== 'undefined';
221223

222224
api.init = function () {
223225
// nothing to init
224226
};
225227

226228
api.enabled = function () {
227-
return (
228-
config.remotebuzzer.usebuttons &&
229-
typeof onStandaloneGalleryView === 'undefined' &&
230-
typeof onCaptureChromaView === 'undefined'
231-
);
229+
return config.remotebuzzer.usebuttons && typeof onStandaloneGalleryView === 'undefined';
232230
};
233231

234232
api.takePicture = function () {
235233
if (this.enabled() && config.picture.enabled) {
236-
photoBooth.thrill('photo');
234+
if (api.chromaCapture) {
235+
if (!api.needsReload) {
236+
api.needsReload = true;
237+
photoBooth.thrill('chroma');
238+
}
239+
} else {
240+
photoBooth.thrill('photo');
241+
}
237242
}
238243
};
239244

240245
api.takeCustom = function () {
241-
if (this.enabled() && config.custom.enabled) {
246+
if (this.enabled() && !api.chromaCapture && config.custom.enabled) {
242247
photoBooth.thrill('custom');
243248
}
244249
};
245250

246251
api.takeVideo = function () {
247-
if (this.enabled() && config.video.enabled) {
252+
if (this.enabled() && !api.chromaCapture && config.video.enabled) {
248253
photoBooth.thrill('video');
249254
}
250255
};
251256

252257
api.takeCollage = function () {
253-
if (this.enabled() && config.collage.enabled) {
258+
if (this.enabled() && !api.chromaCapture && config.collage.enabled) {
254259
this.waitingToProcessCollage = false;
255260
photoBooth.thrill('collage');
256261
}
@@ -267,8 +272,13 @@ function initRemoteBuzzerFromDOM() {
267272

268273
api.print = function () {
269274
if ($('.stage[data-stage="result"]').is(':visible')) {
270-
$('.printbtn').trigger('click');
271-
$('.printbtn').trigger('blur');
275+
if (api.chromaCapture) {
276+
$('[data-command="print-btn"]').trigger('click');
277+
$('[data-command="print-btn"]').trigger('blur');
278+
} else {
279+
$('[data-command="printbtn"]').trigger('click');
280+
$('[data-command="printbtn"]').trigger('blur');
281+
}
272282
} else if ($('.pswp__button--print').is(':visible')) {
273283
$('.pswp__button--print').trigger('click');
274284
} else {
@@ -277,7 +287,7 @@ function initRemoteBuzzerFromDOM() {
277287
};
278288

279289
api.move2usb = function () {
280-
if (this.enabled()) {
290+
if (this.enabled() && !api.chromaCapture) {
281291
photoBooth.thrill('move2usb');
282292
}
283293
};

0 commit comments

Comments
 (0)