Browse Source

enhance: jump to bottom quickly for long pages

Tienson Qin 2 years ago
parent
commit
df01465737
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/main/frontend/components/block.cljs

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

@@ -2840,8 +2840,12 @@
 
 
 (defn- hide-block?
 (defn- hide-block?
   [ref]
   [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
 (defn- get-hidden-atom
   [sub-id *ref {:keys [initial-value]}]
   [sub-id *ref {:keys [initial-value]}]