Skip to content

Commit

Permalink
Merge pull request #118 from WildMeOrg/show_labels_persist
Browse files Browse the repository at this point in the history
show labels checkbox persist between images
  • Loading branch information
TanyaStere42 authored Nov 22, 2024
2 parents cea40ba + 54e244d commit 7badf28
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,11 @@ const imageSelectionFormChange = async () => {
}

//If leave annotation/ground truth page, reset active label to none

if(!document.querySelector("#toggle-switch")) {
sessionStorage.removeItem("toggle-switch");
}

if(!document.querySelector("#activeLabel")) {
sessionStorage.setItem("active-label", "");
}else {
Expand Down
6 changes: 5 additions & 1 deletion assets/simple-boxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,9 @@ window.simpleBoxes._.methods = {

$( document ).ready(function() {

const toggleSwitchSession = sessionStorage.getItem("toggle-switch");
document.querySelector("#toggle-switch").checked = toggleSwitchSession === "false" ? false : true;

const mousemove = async (e, handleId) => {
e.preventDefault();
const fakeEvent = {
Expand Down Expand Up @@ -996,7 +999,8 @@ $( document ).ready(function() {
});

//Toggle to show/hide labels
$("body").on("change", "#toggle-switch", async (e) => {
$("body").on("change", "#toggle-switch", async (e) => {
sessionStorage.setItem("toggle-switch", e.target.checked);
if ($("#toggle-switch").is(":checked")) {
$('i.labelContent').css("display", "block");
$('i.labelBoxTrigger').css("display", "block");
Expand Down

0 comments on commit 7badf28

Please sign in to comment.