Skip to content

Commit 3741fc2

Browse files
committed
run pre-commit
1 parent 5485aad commit 3741fc2

1 file changed

Lines changed: 25 additions & 20 deletions

File tree

src/assets/js/script.js

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Variables
22
let isResizing = false;
3-
let resizeDirection = '';
3+
let resizeDirection = "";
44
let resizeStartX = 0;
55
let resizeStartY = 0;
66
let resizeStartWidth = 0;
@@ -185,16 +185,17 @@ document.addEventListener("mouseup", () => {
185185
dragHeader.style.cursor = "grab";
186186
});
187187

188-
dragContainer.querySelectorAll('.resize-handle').forEach(handle => {
189-
handle.addEventListener('mousedown', (e) => {
188+
dragContainer.querySelectorAll(".resize-handle").forEach((handle) => {
189+
handle.addEventListener("mousedown", (e) => {
190190
e.preventDefault();
191191
e.stopPropagation();
192192

193193
isResizing = true;
194194

195-
resizeDirection = [...handle.classList]
196-
.find(c => c.startsWith('resize-handle-') && c !== 'resize-handle')
197-
?.replace('resize-handle-', '') || 'se';
195+
resizeDirection =
196+
[...handle.classList]
197+
.find((c) => c.startsWith("resize-handle-") && c !== "resize-handle")
198+
?.replace("resize-handle-", "") || "se";
198199

199200
const rect = dragContainer.getBoundingClientRect();
200201
resizeStartX = e.clientX;
@@ -204,39 +205,43 @@ dragContainer.querySelectorAll('.resize-handle').forEach(handle => {
204205
resizeStartTop = rect.top;
205206
resizeStartOutputHeight = consoleOutput.offsetHeight;
206207

207-
dragContainer.style.bottom = 'auto';
208-
dragContainer.style.right = 'auto';
208+
dragContainer.style.bottom = "auto";
209+
dragContainer.style.right = "auto";
209210
dragContainer.style.left = `${rect.left}px`;
210211
dragContainer.style.top = `${rect.top}px`;
211212

212-
dragContainer.classList.remove('transition-all', 'duration-300', 'ease-in-out');
213-
document.body.style.userSelect = 'none';
213+
dragContainer.classList.remove(
214+
"transition-all",
215+
"duration-300",
216+
"ease-in-out",
217+
);
218+
document.body.style.userSelect = "none";
214219
document.body.style.cursor = handle.style.cursor;
215220
});
216221
});
217222

218-
document.addEventListener('mousemove', (e) => {
223+
document.addEventListener("mousemove", (e) => {
219224
if (!isResizing) return;
220225

221226
const dx = e.clientX - resizeStartX;
222227
const dy = e.clientY - resizeStartY;
223228
const dir = resizeDirection;
224229

225-
if (dir.includes('e')) {
230+
if (dir.includes("e")) {
226231
dragContainer.style.width = `${Math.max(MIN_CONSOLE_WIDTH, resizeStartWidth + dx)}px`;
227232
}
228-
if (dir.includes('w')) {
233+
if (dir.includes("w")) {
229234
const newW = resizeStartWidth - dx;
230235
if (newW >= MIN_CONSOLE_WIDTH) {
231236
dragContainer.style.width = `${newW}px`;
232237
dragContainer.style.left = `${resizeStartLeft + dx}px`;
233238
}
234239
}
235240

236-
if (dir.includes('s')) {
241+
if (dir.includes("s")) {
237242
consoleOutput.style.height = `${Math.max(MIN_OUTPUT_HEIGHT, resizeStartOutputHeight + dy)}px`;
238243
}
239-
if (dir.includes('n')) {
244+
if (dir.includes("n")) {
240245
const newH = resizeStartOutputHeight - dy;
241246
if (newH >= MIN_OUTPUT_HEIGHT) {
242247
consoleOutput.style.height = `${newH}px`;
@@ -245,13 +250,13 @@ document.addEventListener('mousemove', (e) => {
245250
}
246251
});
247252

248-
document.addEventListener('mouseup', () => {
253+
document.addEventListener("mouseup", () => {
249254
if (!isResizing) return;
250255
isResizing = false;
251-
resizeDirection = '';
252-
document.body.style.userSelect = '';
253-
document.body.style.cursor = '';
254-
dragContainer.classList.add('transition-all', 'duration-300', 'ease-in-out');
256+
resizeDirection = "";
257+
document.body.style.userSelect = "";
258+
document.body.style.cursor = "";
259+
dragContainer.classList.add("transition-all", "duration-300", "ease-in-out");
255260
});
256261

257262
function minimizeConsole() {

0 commit comments

Comments
 (0)