From 577357b090788f6159693d66b9b1c7fce8639126 Mon Sep 17 00:00:00 2001 From: Sysy's Date: Mon, 30 Mar 2026 12:05:24 +0200 Subject: [PATCH] =?UTF-8?q?Add=20rotateMirror=20to=20rotate=20element=2045?= =?UTF-8?q?=C2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a small utility function in web/assets/js/index.js that increments an element's CSS rotation by 45 degrees. The function reads the element's inline transform (handling an empty value), parses the current rotation angle modulo 360, and sets the new rotate(angle+45) value. --- web/assets/js/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 web/assets/js/index.js diff --git a/web/assets/js/index.js b/web/assets/js/index.js new file mode 100644 index 0000000..42e3a2c --- /dev/null +++ b/web/assets/js/index.js @@ -0,0 +1,9 @@ +function rotateMirror(mirror) { + let angle = 0; + if (mirror.style.transform == "") { + angle = 0; + } else { + angle = parseInt(mirror.style.transform.split("(")[1].split("deg")[0])%360; + } + mirror.style.transform = `rotate(${angle+45}deg)`; +} \ No newline at end of file