Skip to content

Commit

Permalink
scroll: remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
dustingetz committed Dec 21, 2024
1 parent d226c45 commit 84f3902
Showing 1 changed file with 2 additions and 33 deletions.
35 changes: 2 additions & 33 deletions src/hyperfiddle/electric_scroll0.cljc
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
(ns hyperfiddle.electric-scroll0
(:require [clojure.math :as math]
[contrib.assert :refer [check]]
[contrib.data :refer [clamp window]]
[contrib.missionary-contrib :as mx]
[hyperfiddle.electric3 :as e]
[hyperfiddle.electric-dom3 :as dom]
[hyperfiddle.rcf :as rcf]
[hyperfiddle.incseq :as i]
[missionary.core :as m]
[hyperfiddle.electric-local-def3 :as l]))

Expand Down Expand Up @@ -59,46 +57,17 @@
(e/client (doto (e/input (scroll-window row-height record-count node props))
#_(prn 'Scroll-window))))

(e/defn Spool2 [cnt xs! offset limit]
(e/defn Spool2 [cnt xs! offset limit] ; legacy
(->> xs!
(map vector (cycle (range limit)))
(window cnt offset limit)
(e/diff-by first)))

(e/defn Spool [cnt xs! offset limit]
(e/defn Spool [cnt xs! offset limit] ; legacy
(->> (map-indexed vector xs!)
(window cnt offset limit)
(e/diff-by #(mod (first %) limit))))

(e/defn Unrotate [limit xs]
(let [s (i/spine)]
(e/for [[i x] xs]
(s (mod i limit) {} [i x])
#_(e/amb)) ; undo permutations
(e/join s)))

#_
(e/defn Spool-scroll [record-count xs row-height node]
(Spool record-count xs (Scroll-window row-height record-count node)))

(e/defn Scroll-indexed-headless
"random access (fixed height, counted, indexed)"
[viewport-node xs!
#_& {:keys [record-count row-height overquery-factor]
:or {overquery-factor 1}}]
(let [record-count (or record-count (count xs!))
row-height (check row-height) ; todo measure, account for browser zoom level
[offset limit] (Scroll-window row-height record-count viewport-node {:overquery-factor overquery-factor})]
{::Spool (e/fn [] (Spool record-count xs! offset limit)) ; site neutral, caller chooses
::Offset (e/fn [] ; isolate animating value to not rebuild hashmap - micro optimization
(identity offset)) ; experimental: allow user to artificially delay offset if needed for UX
::limit limit ::record-count record-count ::row-height row-height}))

(e/defn TableScrollFixedCounted
[xs! TableBody
#_& {:keys [row-height]
:as props}])

(defn index-ring
"Return a vector of numbers of size `size` containing numbers [0..size[ shifted by `offset`, in the direction of sgn(offset).
Contrary to usual \"sliding window\" shifting, where all slots shift one place left or right, this ring shifts as a tape.
Expand Down

0 comments on commit 84f3902

Please sign in to comment.