瀏覽代碼

fix: remove resizing class on tab

Konstantinos Kaloutas 3 年之前
父節點
當前提交
b150e1aa09
共有 1 個文件被更改,包括 6 次插入7 次删除
  1. 6 7
      src/main/frontend/components/right_sidebar.cljs

+ 6 - 7
src/main/frontend/components/right_sidebar.cljs

@@ -206,15 +206,14 @@
              (.on "keydown" (fn [e]
                               (when-let [sidebar-el (js/document.getElementById sidebar-id)]
                                 (let [width js/document.documentElement.clientWidth
-                                      offset (+
-                                              (.-x (.getBoundingClientRect sidebar-el))
-                                              (case (.-code e)
-                                                "ArrowLeft" (- keyboard-step)
-                                                "ArrowRight" keyboard-step
-                                                0))
+                                      keyboard-step (case (.-code e)
+                                                      "ArrowLeft" (- keyboard-step)
+                                                      "ArrowRight" keyboard-step
+                                                      0)
+                                      offset (+ (.-x (.getBoundingClientRect sidebar-el)) keyboard-step)
                                       ratio (.toFixed (/ offset width) 6)
                                       ratio (if (= handler-position :west) (- 1 ratio) ratio)]
-                                  (when (and (> ratio min-ratio) (< ratio max-ratio)) 
+                                  (when (and (> ratio min-ratio) (< ratio max-ratio) (not (zero? keyboard-step)))
                                     ((add-resizing-class)
                                      (set-width! ratio sidebar-el)))))))
              (.on "keyup" remove-resizing-class)))