From c7d6e1b3a415ee74e74c07a27700bfb0d1be470e 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(+) diff --git a/web/assets/js/index.js b/web/assets/js/index.js index e69de29..42e3a2c 100644 --- a/web/assets/js/index.js +++ 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