⬆️ Update beicon library (frontend).

This commit is contained in:
Andrey Antukh 2021-04-29 13:03:39 +02:00 committed by alonso.torres
parent 3a4f63848d
commit 056b80939e
4 changed files with 11 additions and 13 deletions

View file

@ -14,7 +14,7 @@
[danlentz/clj-uuid "0.1.9"] [danlentz/clj-uuid "0.1.9"]
[frankiesardo/linked "1.3.0"] [frankiesardo/linked "1.3.0"]
[funcool/beicon "2021.04.12-1"] [funcool/beicon "2021.04.27-2"]
[funcool/cuerdas "2020.03.26-3"] [funcool/cuerdas "2020.03.26-3"]
[funcool/okulary "2020.04.14-0"] [funcool/okulary "2020.04.14-0"]
[funcool/potok "3.2.0"] [funcool/potok "3.2.0"]

View file

@ -94,8 +94,8 @@
[page-id frame-id points filter-shapes zoom] [page-id frame-id points filter-shapes zoom]
(let [snap-x (search-snap page-id frame-id points :x filter-shapes zoom) (let [snap-x (search-snap page-id frame-id points :x filter-shapes zoom)
snap-y (search-snap page-id frame-id points :y filter-shapes zoom)] snap-y (search-snap page-id frame-id points :y filter-shapes zoom)]
;; snap-x is the second parameter because is the "source" to combine (rx/combine-latest snap-x snap-y)))
(rx/combine-latest snap->vector snap-y snap-x)))
(defn sr-distance [coord sr1 sr2] (defn sr-distance [coord sr1 sr2]
(let [c1 (if (= coord :x) :x1 :y1) (let [c1 (if (= coord :x) :x1 :y1)
@ -174,8 +174,7 @@
(if (mth/finite? min-snap) [0 min-snap] nil))) (if (mth/finite? min-snap) [0 min-snap] nil)))
(defn search-snap-distance [selrect coord shapes-lt shapes-gt zoom] (defn search-snap-distance [selrect coord shapes-lt shapes-gt zoom]
(->> shapes-lt (->> (rx/combine-latest shapes-lt shapes-gt)
(rx/combine-latest vector shapes-gt)
(rx/map (fn [[shapes-lt shapes-gt]] (rx/map (fn [[shapes-lt shapes-gt]]
(calculate-snap coord selrect shapes-lt shapes-gt zoom))))) (calculate-snap coord selrect shapes-lt shapes-gt zoom)))))
@ -203,7 +202,7 @@
(d/mapm #(select-shapes-area page-id shapes objects %2))) (d/mapm #(select-shapes-area page-id shapes objects %2)))
snap-x (search-snap-distance selrect :x (:left areas) (:right areas) zoom) snap-x (search-snap-distance selrect :x (:left areas) (:right areas) zoom)
snap-y (search-snap-distance selrect :y (:top areas) (:bottom areas) zoom)] snap-y (search-snap-distance selrect :y (:top areas) (:bottom areas) zoom)]
(rx/combine-latest snap->vector snap-y snap-x))))))) (rx/combine-latest snap-x snap-y)))))))
(defn closest-snap-point (defn closest-snap-point
[page-id shapes layout zoom point] [page-id shapes layout zoom point]

View file

@ -233,9 +233,8 @@
(rx/map #(set/difference % selected)) (rx/map #(set/difference % selected))
(rx/map #(->> % (map (partial get @refs/workspace-page-objects))))) (rx/map #(->> % (map (partial get @refs/workspace-page-objects)))))
(rx/of nil))))] (rx/of nil))))]
(rx/combine-latest (query-side lt-side)
(->> (query-side lt-side) (query-side gt-side))))
(rx/combine-latest vector (query-side gt-side)))))
[lt-shapes gt-shapes] @to-measure [lt-shapes gt-shapes] @to-measure

View file

@ -120,10 +120,10 @@
(mf/use-effect (mf/use-effect
(fn [] (fn []
(let [sub (->> subject (let [sub (->> subject
(rx/switch-map #(rx/combine-latest (rx/switch-map #(rx/combine-latest (get-snap :x %)
d/concat (get-snap :y %)))
(get-snap :y %) (rx/map (fn [result]
(get-snap :x %))) (apply d/concat (seq result))))
(rx/subs #(let [rs (filter (fn [[_ snaps _]] (> (count snaps) 0)) %)] (rx/subs #(let [rs (filter (fn [[_ snaps _]] (> (count snaps) 0)) %)]
(reset! state rs))))] (reset! state rs))))]