Skip to content

Commit 9d705f1

Browse files
committed
fix issue with overlapping frames
1 parent 4275f6a commit 9d705f1

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

css/admin_style.css

+4
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,8 @@
182182
position: absolute;
183183
top: 0;
184184
left: 0;
185+
}
186+
187+
.mugshot-hidden-while-selecting {
188+
display: none !important;
185189
}

js/admin_mug.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ function beginCapture(e) {
414414
MugShot.selecting = true;
415415
MugShot.img.addEventListener('mousemove', updateCapture);
416416
MugShot.img.addEventListener('mouseup', haltCapture);
417+
417418
// left top height width
418419
var frame = {
419420
'lft': e.pageX - MugShot.offset.left,
@@ -424,13 +425,14 @@ function beginCapture(e) {
424425

425426
MugShot.createBoundingBox(frame);
426427

427-
// // Hide all the frames while we select the new one. Keeps them from interfering.
428-
// MugShot.mugs.forEach(mug => {
429-
// mug.frame.el.style = 'hidden';
430-
// mug.name.el.style = 'hidden';
431-
// });
428+
// Hide all the frames while we select the new one. Keeps them from interfering.
429+
for (let index = 0; index < MugShot.mugs.length - 1; index++) {
430+
MugShot.mugs[index].frame.el.classList.toggle('mugshot-hidden-while-selecting');
431+
MugShot.mugs[index].name.el.classList.toggle('mugshot-hidden-while-selecting');
432+
}
432433

433434
MugShot.mugs[MugShot.cfi].frame.el.classList.toggle('mugshot-active');
435+
434436
MugShot.toggleSubmitBtn('on');
435437
}
436438
}
@@ -448,6 +450,13 @@ function haltCapture(e) {
448450
MugShot.img.removeEventListener('mouseup', haltCapture, false);
449451
MugShot.mugs[MugShot.cfi].frame.el.ondblclick = updateBoundingBox;
450452
MugShot.mugs[MugShot.cfi].frame.el.classList.toggle('mugshot-mousetrap');
453+
454+
// Done capturing so re-show the other mugshot frames
455+
for (let index = 0; index < MugShot.mugs.length - 1; index++) {
456+
MugShot.mugs[index].frame.el.classList.toggle('mugshot-hidden-while-selecting');
457+
MugShot.mugs[index].name.el.classList.toggle('mugshot-hidden-while-selecting');
458+
}
459+
451460
var pos = MugShot.setBoundingBoxPosition(e.pageX - MugShot.offset.left, e.pageY - MugShot.offset.top);
452461
MugShot.mugs[MugShot.cfi].frame.left = pos[0];
453462
MugShot.mugs[MugShot.cfi].frame.top = pos[1];

0 commit comments

Comments
 (0)