Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Continue collage with keypress #408

Merged
merged 5 commits into from
Apr 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ const photoBooth = (function () {
api.toggleMailDialog(img);
});

$('#send-mail-form').on('submit', function (e) {
mailSendForm.on('submit', function (e) {
e.preventDefault();

const form = $(this);
Expand Down Expand Up @@ -1244,7 +1244,7 @@ const photoBooth = (function () {
}
});

$('.qrbtn').on('click', function (e) {
qrBtn.on('click', function (e) {
e.preventDefault();
e.stopPropagation();

Expand Down Expand Up @@ -1305,11 +1305,29 @@ const photoBooth = (function () {
$('.newcollage').blur();
});

api.handleButtonPressWhileTakingPic = function () {
if (nextCollageNumber > 0) {
const btnCollageNext = $('#btnCollageNext');
const btnCollageProcess = $('#btnCollageProcess');
if (btnCollageNext.length) {
photoboothTools.console.logDev('Next collage image triggered by keypress.');
btnCollageNext.trigger('click');
} else if (btnCollageProcess.length) {
photoboothTools.console.logDev('Processing collage triggered by keypress.');
btnCollageProcess.trigger('click');
} else {
photoboothTools.console.logDev('Taking picture already in progress!');
}
} else {
photoboothTools.console.logDev('Taking picture already in progress!');
}
};

$(document).on('keyup', function (ev) {
if (triggerPic[0] || triggerCollage[0]) {
if (config.picture.key && parseInt(config.picture.key, 10) === ev.keyCode) {
if (takingPic) {
photoboothTools.console.logDev('Taking picture already in progress!');
api.handleButtonPressWhileTakingPic();
} else {
$('.closeGallery').trigger('click');
if (config.collage.enabled && config.collage.only) {
Expand All @@ -1325,7 +1343,7 @@ const photoBooth = (function () {

if (config.collage.key && parseInt(config.collage.key, 10) === ev.keyCode) {
if (takingPic) {
photoboothTools.console.logDev('Taking picture already in progress!');
api.handleButtonPressWhileTakingPic();
} else {
$('.closeGallery').trigger('click');
if (config.collage.enabled) {
Expand Down