Skip to content

Commit d53a155

Browse files
authored
Gradient Maker Addon -- Remove tint and close modal on blur
1 parent a24168a commit d53a155

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/addons/addons/paint-gradient-maker/userscript.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,11 @@ export default async function () {
534534

535535
const container = document.createElement("div");
536536
container.classList.add("SP-gradient-maker");
537-
container.setAttribute("style", `position: absolute; z-index: 9999; pointer-events: auto; background-color: rgba(0,0,0,.1); width: 100%; height: 100vh;`);
537+
container.setAttribute("style", `position: absolute; z-index: 9999; pointer-events: none; background-color: transparent; width: 100%; height: 100vh;`);
538538

539539
const modal = document.createElement("div");
540540
modal.classList.add("gradient-modal");
541-
modal.setAttribute("style", `color: var(--paint-text-primary, #575e75); width: 450px; height: 260px; display: block; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--ui-secondary, hsla(215, 75%, 95%, 1)); border: solid 2px var(--ui-black-transparent, hsla(0, 0%, 0%, 0.15)); border-radius: 5px; padding: 15px;`);
541+
modal.setAttribute("style", `pointer-events: auto; color: var(--paint-text-primary, #575e75); width: 450px; height: 260px; display: block; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--ui-secondary, hsla(215, 75%, 95%, 1)); border: solid 2px var(--ui-black-transparent, hsla(0, 0%, 0%, 0.15)); border-radius: 5px; padding: 15px;`);
542542
modalStorage.modal = modal;
543543

544544
const title = document.createElement("span");
@@ -577,6 +577,11 @@ export default async function () {
577577
else if (oldCache) decodeFromCache(oldCache.settings, draggables, settings);
578578
else draggables.append(createDraggable(), createDraggable());
579579
updateDisplay();
580+
581+
container.addEventListener("click", (e) => {
582+
if (e.target.getAttribute("class") === "SP-gradient-maker") container.remove();
583+
e.stopPropagation();
584+
});
580585
}
581586

582587
function startListenerWorker() {

0 commit comments

Comments
 (0)