Toggle pause on box bar loading
Signed-off-by: James Ketrenos <james_gitlab@ketrenos.com>
This commit is contained in:
parent
594670fdad
commit
fd50a6969c
@ -154,6 +154,8 @@ function makeFaceBoxes() {
|
|||||||
box.style.width = Math.floor((face.right - face.left) * width) + "%";
|
box.style.width = Math.floor((face.right - face.left) * width) + "%";
|
||||||
box.style.height = Math.floor((face.bottom - face.top) * height) + "%";
|
box.style.height = Math.floor((face.bottom - face.top) * height) + "%";
|
||||||
box.addEventListener("click", (event) => {
|
box.addEventListener("click", (event) => {
|
||||||
|
setPause(true);
|
||||||
|
|
||||||
var bar = document.getElementById("bar");
|
var bar = document.getElementById("bar");
|
||||||
if (!bar) {
|
if (!bar) {
|
||||||
bar = document.createElement("div");
|
bar = document.createElement("div");
|
||||||
@ -194,6 +196,17 @@ function makeFaceBoxes() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setPause(state) {
|
||||||
|
paused = state;
|
||||||
|
if (!paused) {
|
||||||
|
tick();
|
||||||
|
} else {
|
||||||
|
document.getElementById("loading").textContent = "||";
|
||||||
|
clearTimeout(scheduled);
|
||||||
|
scheduled = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function loadPhoto(index) {
|
function loadPhoto(index) {
|
||||||
const photo = photos[index],
|
const photo = photos[index],
|
||||||
xml = new XMLHttpRequest(),
|
xml = new XMLHttpRequest(),
|
||||||
@ -319,14 +332,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||||||
document.addEventListener("keydown", function(event) {
|
document.addEventListener("keydown", function(event) {
|
||||||
switch (event.keyCode) {
|
switch (event.keyCode) {
|
||||||
case 32: /* space */
|
case 32: /* space */
|
||||||
paused = !paused;
|
setPause(!paused);
|
||||||
if (!paused) {
|
|
||||||
tick();
|
|
||||||
} else {
|
|
||||||
document.getElementById("loading").textContent = "||";
|
|
||||||
clearTimeout(scheduled);
|
|
||||||
scheduled = null;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 37: /* left */
|
case 37: /* left */
|
||||||
|
@ -793,8 +793,7 @@ function getFacesForPhoto(id) {
|
|||||||
return photoDB.sequelize.query(
|
return photoDB.sequelize.query(
|
||||||
"SELECT face1Id,face2Id " +
|
"SELECT face1Id,face2Id " +
|
||||||
"FROM facedistances " +
|
"FROM facedistances " +
|
||||||
"WHERE distance<0.5 AND (face1Id=:id OR face2Id=:id) " +
|
"WHERE distance>0 AND distance<=0.5 AND (face1Id=:id OR face2Id=:id)", {
|
||||||
"ORDER BY distance ASC", {
|
|
||||||
replacements: {
|
replacements: {
|
||||||
id: face.id
|
id: face.id
|
||||||
},
|
},
|
||||||
@ -811,7 +810,8 @@ function getFacesForPhoto(id) {
|
|||||||
" (fd.face1Id=faces.id AND fd.face2Id=:faceId) " +
|
" (fd.face1Id=faces.id AND fd.face2Id=:faceId) " +
|
||||||
"OR (fd.face2Id=faces.id AND fd.face1Id=:faceId) " +
|
"OR (fd.face2Id=faces.id AND fd.face1Id=:faceId) " +
|
||||||
") " +
|
") " +
|
||||||
"WHERE faces.id IN (:ids)", {
|
"WHERE faces.id IN (:ids) " +
|
||||||
|
"ORDER BY fd.distance ASC", {
|
||||||
replacements: {
|
replacements: {
|
||||||
ids: faceIds.map((match) => {
|
ids: faceIds.map((match) => {
|
||||||
return (match.face1Id == face.id) ? match.face2Id : match.face1Id;
|
return (match.face1Id == face.id) ? match.face2Id : match.face1Id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user