Просмотр исходного кода

enhance: jump to bottom quickly for long pages

Tienson Qin 2 лет назад
Родитель
Сommit
df01465737
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      src/main/frontend/components/block.cljs

+ 6 - 2
src/main/frontend/components/block.cljs

@@ -2840,8 +2840,12 @@
 
 (defn- hide-block?
   [ref]
-  (let [top (.-top (.getBoundingClientRect ref))]
-    (> top (+ js/window.innerHeight 500))))
+  (let [rect (.getBoundingClientRect ref)
+        top (.-top rect)
+        bottom (.-bottom rect)]
+    (or
+     (< bottom -200)
+     (> top (+ js/window.innerHeight 500)))))
 
 (defn- get-hidden-atom
   [sub-id *ref {:keys [initial-value]}]