Commit f48bce5f authored by Danil Boldyrev's avatar Danil Boldyrev

Corrected the code according to Code style

parent 9e69009d
......@@ -14,12 +14,12 @@ function getActiveTab(elements, all = false) {
}
}
onUiLoaded(async () => {
onUiLoaded(async() => {
const hotkeysConfig = {
resetZoom: "KeyR",
fitToScreen: "KeyS",
moveKey: "KeyF",
overlap: "KeyO",
overlap: "KeyO"
};
let isMoving = false;
......@@ -29,12 +29,12 @@ onUiLoaded(async () => {
sketch: "#img2img_sketch",
inpaint: "#img2maskimg",
inpaintSketch: "#inpaint_sketch",
img2imgTabs: "#mode_img2img .tab-nav",
img2imgTabs: "#mode_img2img .tab-nav"
};
async function getElements() {
const elements = await Promise.all(
Object.values(elementIDs).map((id) => document.querySelector(id))
Object.values(elementIDs).map(id => document.querySelector(id))
);
return Object.fromEntries(
Object.keys(elementIDs).map((key, index) => [key, elements[index]])
......@@ -116,13 +116,18 @@ onUiLoaded(async () => {
percentage = 5
) {
const input =
document.querySelector(`${elemId} input[aria-label='Brush radius']`) ||
document.querySelector(`${elemId} button[aria-label="Use brush"]`);
document.querySelector(
`${elemId} input[aria-label='Brush radius']`
) ||
document.querySelector(
`${elemId} button[aria-label="Use brush"]`
);
if (input) {
input.click();
if (!withoutValue) {
const maxValue = parseFloat(input.getAttribute("max")) || 100;
const maxValue =
parseFloat(input.getAttribute("max")) || 100;
const changeAmount = maxValue * (percentage / 100);
const newValue =
parseFloat(input.value) +
......@@ -134,7 +139,7 @@ onUiLoaded(async () => {
}
// Reset zoom when uploading a new image
fileInput = document.querySelector(
const fileInput = document.querySelector(
`${elemId} input[type="file"][accept="image/*"].svelte-116rqfv`
);
fileInput.addEventListener("click", resetZoom);
......@@ -211,7 +216,8 @@ onUiLoaded(async () => {
const originYValue = parseFloat(originY);
const offsetX =
(screenWidth - elementWidth * scale) / 2 - originXValue * (1 - scale);
(screenWidth - elementWidth * scale) / 2 -
originXValue * (1 - scale);
const offsetY =
(screenHeight - elementHeight * scale) / 2.5 -
originYValue * (1 - scale);
......@@ -305,7 +311,7 @@ onUiLoaded(async () => {
const hotkeyActions = {
[hotkeysConfig.resetZoom]: resetZoom,
[hotkeysConfig.overlap]: toggleOverlap,
[hotkeysConfig.fitToScreen]: fitToScreen,
[hotkeysConfig.fitToScreen]: fitToScreen
// [hotkeysConfig.moveKey] : moveCanvas,
};
......@@ -354,7 +360,7 @@ onUiLoaded(async () => {
}
});
targetElement.addEventListener("wheel", (e) => {
targetElement.addEventListener("wheel", e => {
// change zoom level
const operation = e.deltaY > 0 ? "-" : "+";
changeZoomLevel(operation, e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment