formatting

This commit is contained in:
cmdr2 2023-08-15 16:58:12 +05:30
parent 34de4fe8fe
commit 01c1c77564

View File

@ -2786,7 +2786,7 @@ let recentResolutionsValues = []
function makeResolutionButtons(listElement, resolutionList) { function makeResolutionButtons(listElement, resolutionList) {
listElement.innerHTML = "" listElement.innerHTML = ""
resolutionList.forEach((el) => { resolutionList.forEach((el) => {
let button = createElement("button", {style: "width: 8em;"}, "tertiaryButton", `${el.w}×${el.h}`) let button = createElement("button", { style: "width: 8em;" }, "tertiaryButton", `${el.w}×${el.h}`)
button.addEventListener("click", () => { button.addEventListener("click", () => {
customWidthField.value = el.w customWidthField.value = el.w
customHeightField.value = el.h customHeightField.value = el.h
@ -2797,10 +2797,12 @@ let recentResolutionsValues = []
}) })
} }
enlargeButtons.querySelectorAll("button").forEach( button => button.addEventListener("click", e => { enlargeButtons.querySelectorAll("button").forEach((button) =>
button.addEventListener("click", (e) => {
enlargeImageSize(parseFloat(button.dataset["factor"])) enlargeImageSize(parseFloat(button.dataset["factor"]))
hidePopup() hidePopup()
})) })
)
customWidthField.addEventListener("change", () => { customWidthField.addEventListener("change", () => {
let w = customWidthField.value let w = customWidthField.value
@ -2842,7 +2844,7 @@ let recentResolutionsValues = []
] ]
let _jsonstring = localStorage.recentResolutionsValues let _jsonstring = localStorage.recentResolutionsValues
if (_jsonstring == undefined) { if (_jsonstring == undefined) {
recentResolutionsValues = defaultResolutionsValues; recentResolutionsValues = defaultResolutionsValues
localStorage.recentResolutionsValues = JSON.stringify(recentResolutionsValues) localStorage.recentResolutionsValues = JSON.stringify(recentResolutionsValues)
} else { } else {
recentResolutionsValues = JSON.parse(localStorage.recentResolutionsValues) recentResolutionsValues = JSON.parse(localStorage.recentResolutionsValues)
@ -2887,17 +2889,17 @@ let recentResolutionsValues = []
} }
}) })
resizeSlider.addEventListener("input", e => { resizeSlider.addEventListener("input", (e) => {
let w = parseInt(resizeSlider.dataset["w"]) let w = parseInt(resizeSlider.dataset["w"])
let h = parseInt(resizeSlider.dataset["h"]) let h = parseInt(resizeSlider.dataset["h"])
let factor = parseFloat(resizeSlider.value) let factor = parseFloat(resizeSlider.value)
let step = customWidthField.step let step = customWidthField.step
customWidthField.value = roundToMultiple(w*factor*factor, step) customWidthField.value = roundToMultiple(w * factor * factor, step)
customHeightField.value = roundToMultiple(h*factor*factor, step) customHeightField.value = roundToMultiple(h * factor * factor, step)
}) })
resizeSlider.addEventListener("change", e => { resizeSlider.addEventListener("change", (e) => {
hidePopup() hidePopup()
}) })