From 02bc3ef0cab54a3c90e292c3c85ba184f2f52cc8 Mon Sep 17 00:00:00 2001 From: erinz2020 Date: Fri, 22 Nov 2024 15:32:22 +0000 Subject: [PATCH 1/2] don't fill the bounding boxes, set border to 2px red --- assets/simple-boxes.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/assets/simple-boxes.js b/assets/simple-boxes.js index b7c1646..8587d14 100644 --- a/assets/simple-boxes.js +++ b/assets/simple-boxes.js @@ -5,8 +5,6 @@ * Dependencies: jquery * */ - - /* * API: * @@ -624,7 +622,7 @@ window.simpleBoxes._.methods = { drawIndividualBox : async(handle,box,isHover) => { // Draw the box itself - handle.canvas.ctx.fillStyle = 'rgba(255, 0, 26, 0.35)'; + handle.canvas.ctx.fillStyle = 'rgba(255, 0, 26, 0.01)'; if(isHover){ handle.canvas.ctx.fillStyle = 'rgba(255, 136, 46, 0.35)'; } @@ -649,7 +647,9 @@ window.simpleBoxes._.methods = { top: ${copy.h > 0 ? copy.y +2: copy.y + copy.h +2}px; left: ${copy.w > 0 ? copy.x +2: copy.x + copy.w +2}px; width: ${Math.abs(copy.w)-4}px; - height: ${Math.abs(copy.h)-4}px"> + height: ${Math.abs(copy.h)-4}px; + border: 2px solid red; + "> `; if(!handle.readOnly){ @@ -809,7 +809,10 @@ window.simpleBoxes._.methods = { -$( document ).ready(function() { +$( 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(); @@ -997,6 +1000,7 @@ $( document ).ready(function() { //Toggle to show/hide labels $("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"); From 794d278fe4de435134a35a237fd54db90a4ac053 Mon Sep 17 00:00:00 2001 From: erinz2020 Date: Fri, 22 Nov 2024 15:36:08 +0000 Subject: [PATCH 2/2] oops, remove some unnecessary code --- assets/simple-boxes.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/assets/simple-boxes.js b/assets/simple-boxes.js index 8587d14..5ae1322 100644 --- a/assets/simple-boxes.js +++ b/assets/simple-boxes.js @@ -811,9 +811,6 @@ 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 = { @@ -999,8 +996,7 @@ $( document ).ready(function() { }); //Toggle to show/hide labels - $("body").on("change", "#toggle-switch", async (e) => { - sessionStorage.setItem("toggle-switch", e.target.checked); + $("body").on("change", "#toggle-switch", async (e) => { if ($("#toggle-switch").is(":checked")) { $('i.labelContent').css("display", "block"); $('i.labelBoxTrigger').css("display", "block");