0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-13 18:48:37 -05:00

Merge pull request #262 from uxbox/other/coll-of-issues

Fixes
This commit is contained in:
Hirunatan 2020-06-16 15:51:47 +02:00 committed by GitHub
commit 249a9558f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 147 additions and 257 deletions

View file

@ -165,115 +165,6 @@
res (cp/process-changes data [chg])]
(t/is (= 0 (count (:objects res))))))
(t/deftest process-change-mod-obj-abs-order
(let [id1 (uuid/next)
id2 (uuid/next)
id3 (uuid/next)
data (-> cp/default-page-data
(assoc-in [:objects uuid/zero :shapes] [id1 id2 id3]))]
(t/testing "abs order 1"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :abs-order
:id id3
:index 0}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id3 id1 id2] (get-in res [:objects uuid/zero :shapes])))))
(t/testing "abs order 2"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :abs-order
:id id1
:index 100}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id2 id3 id1] (get-in res [:objects uuid/zero :shapes])))))
(t/testing "abs order 3"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :abs-order
:id id3
:index 1}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id1 id3 id2] (get-in res [:objects uuid/zero :shapes])))))
))
(t/deftest process-change-mod-obj-rel-order
(let [id1 (uuid/next)
id2 (uuid/next)
id3 (uuid/next)
data (-> cp/default-page-data
(assoc-in [:objects uuid/zero :shapes] [id1 id2 id3]))]
(t/testing "rel order 1"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :rel-order
:id id3
:loc :down}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id1 id3 id2] (get-in res [:objects uuid/zero :shapes])))))
(t/testing "rel order 2"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :rel-order
:id id1
:loc :top}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id2 id3 id1] (get-in res [:objects uuid/zero :shapes])))))
(t/testing "rel order 3"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :rel-order
:id id2
:loc :up}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id1 id3 id2] (get-in res [:objects uuid/zero :shapes])))))
(t/testing "rel order 4"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :rel-order
:id id3
:loc :bottom}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id3 id1 id2] (get-in res [:objects uuid/zero :shapes])))))
))
(t/deftest process-change-move-objects
(let [frame-a-id (uuid/custom 1)
frame-b-id (uuid/custom 2)

View file

@ -255,15 +255,17 @@
(declare transform-shape-point)
(defn shape->points [shape]
(let [points
(case (:type shape)
(:curve :path) (:segments shape)
(let [{:keys [x y width height]} shape]
[(gpt/point x y)
(gpt/point (+ x width) y)
(gpt/point (+ x width) (+ y height))
(gpt/point x (+ y height))]))]
(mapv #(transform-shape-point % shape (:transform shape (gmt/matrix))) points)))
(let [points (case (:type shape)
(:curve :path) (:segments shape)
(let [{:keys [x y width height]} shape]
[(gpt/point x y)
(gpt/point (+ x width) y)
(gpt/point (+ x width) (+ y height))
(gpt/point x (+ y height))]))]
(->> points
(map #(transform-shape-point % shape (:transform shape (gmt/matrix))))
(map gpt/round)
(vec))))
(defn points->selrect [points]
(let [minx (transduce (map :x) min ##Inf points)
@ -756,8 +758,10 @@
new-shape (as-> shape $
(merge $ rec)
(update $ :x #(mth/precision % 2))
(update $ :y #(mth/precision % 2))
(update $ :x #(mth/precision % 0))
(update $ :y #(mth/precision % 0))
(update $ :width #(mth/precision % 0))
(update $ :height #(mth/precision % 0))
(fix-invalid-rect-values $)
(update $ :transform #(gmt/multiply (or % (gmt/matrix)) stretch-matrix))
(update $ :transform-inverse #(gmt/multiply stretch-matrix-inverse (or % (gmt/matrix))))
@ -766,7 +770,6 @@
(update $ :rotation #(mod (+ % (get-in $ [:modifiers :rotation] 0)) 360))
)]
new-shape))
(declare update-path-selrect)

View file

@ -98,8 +98,8 @@
(defn precision
[v n]
(when (and (number? v) (number? n))
#?(:cljs (js/parseFloat (.toFixed v n))
:clj (.. (BigDecimal/valueOf v) (setScale n java.math.RoundingMode/HALF_UP) (doubleValue)))))
(let [d (pow 10 n)]
(/ (round (* v d)) d))))
(defn radians
"Converts degrees to radians."

View file

@ -156,21 +156,14 @@
(s/def ::ids (s/coll-of ::us/uuid))
(s/def ::attr keyword?)
(s/def ::val any?)
(s/def ::val any?)
(s/def ::frame-id uuid?)
(s/def ::loc #{:top :bottom :up :down})
(defmulti operation-spec-impl :type)
(defmethod operation-spec-impl :set [_]
(s/keys :req-un [::attr ::val]))
(defmethod operation-spec-impl :abs-order [_]
(s/keys :req-un [::id ::index]))
(defmethod operation-spec-impl :rel-order [_]
(s/keys :req-un [::id ::loc]))
(s/def ::operation (s/multi-spec operation-spec-impl :type))
(s/def ::operations (s/coll-of ::operation))
@ -465,7 +458,6 @@
(reduce remove-from-old-parent $ shapes)
(reduce update-frame-ids $ (get-in $ [:objects parent-id :shapes]))))))
(defmethod process-operation :set
[shape op]
(let [attr (:attr op)
@ -474,32 +466,6 @@
(dissoc shape attr)
(assoc shape attr val))))
(defmethod process-operation :abs-order
[obj {:keys [id index]}]
(assert (vector? (:shapes obj)) ":shapes should be a vector")
(update obj :shapes (fn [items]
(let [[b a] (->> (remove #(= % id) items)
(split-at index))]
(vec (concat b [id] a))))))
(defmethod process-operation :rel-order
[obj {:keys [id loc] :as change}]
(assert (vector? (:shapes obj)) ":shapes should be a vector")
(let [shapes (:shapes obj)
cindex (d/index-of shapes id)
nindex (case loc
:top (- (count shapes) 1)
:down (max 0 (- cindex 1))
:up (min (- (count shapes) 1) (inc cindex))
:bottom 0)]
(update obj :shapes
(fn [shapes]
(let [[fst snd] (->> (remove #(= % id) shapes)
(split-at nindex))]
(d/concat [] fst [id] snd))))))
(defmethod process-operation :default
[shape op]
(ex/raise :type :operation-not-implemented

View file

@ -748,23 +748,33 @@
(ptk/reify ::vertical-order-selected-shpes
ptk/WatchEvent
(watch [_ state stream]
(let [page-id (:current-page-id state)
objects (get-in state [:workspace-data page-id :objects])
selected (seq (get-in state [:workspace-local :selected]))
(let [page-id (:current-page-id state)
objects (get-in state [:workspace-data page-id :objects])
selected (get-in state [:workspace-local :selected])
rchanges (mapv (fn [id]
(let [frame-id (get-in objects [id :frame-id])]
{:type :mod-obj
:id frame-id
:operations [{:type :rel-order :id id :loc loc}]}))
(let [obj (get objects id)
parent (get objects (:parent-id obj))
shapes (:shapes parent)
cindex (d/index-of shapes id)
nindex (case loc
:top (count shapes)
:down (max 0 (- cindex 1))
:up (min (count shapes) (+ (inc cindex) 1))
:bottom 0)]
{:type :mov-objects
:parent-id (:parent-id obj)
:frame-id (:frame-id obj)
:index nindex
:shapes [id]}))
selected)
uchanges (mapv (fn [id]
(let [frame-id (get-in objects [id :frame-id])
shapes (get-in objects [frame-id :shapes])
cindex (d/index-of shapes id)]
{:type :mod-obj
:id frame-id
:operations [{:type :abs-order :id id :index cindex}]}))
uchanges (mapv (fn [id]
(let [obj (get objects id)]
{:type :mov-objects
:parent-id (:parent-id obj)
:frame-id (:frame-id obj)
:shapes [id]
:index (cph/position-on-parent id objects)}))
selected)]
(rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true}))))))

View file

@ -76,24 +76,25 @@
[ma mb]
(let [ma-keys (set (keys ma))
mb-keys (set (keys mb))
added (set/difference mb-keys ma-keys)
added (set/difference mb-keys ma-keys)
removed (set/difference ma-keys mb-keys)
both (set/intersection ma-keys mb-keys)]
both (set/intersection ma-keys mb-keys)]
(d/concat
(mapv #(array-map :type :set :attr % :val (get mb %)) added)
(mapv #(array-map :type :set :attr % :val nil) removed)
(loop [k (first both)
r (rest both)
rs []]
(if k
(let [vma (get ma k)
(loop [items (seq both)
result []]
(if items
(let [k (first items)
vma (get ma k)
vmb (get mb k)]
(if (= vma vmb)
(recur (first r) (rest r) rs)
(recur (first r) (rest r) (conj rs {:type :set
:attr k
:val vmb}))))
rs)))))
(recur (next items) result)
(recur (next items)
(conj result {:type :set
:attr k
:val vmb}))))
result)))))
(defn- generate-changes
[prev curr]

View file

@ -211,7 +211,7 @@
(rx/filter #(> % 1))
(rx/take 1)
(rx/with-latest vector ms/mouse-position-alt)
(rx/flat-map
(rx/mapcat
(fn [[_ alt?]]
(if alt?
;; When alt is down we start a duplicate+move
@ -242,15 +242,16 @@
(watch [_ state stream]
(let [page-id (get state :current-page-id)
objects (get-in state [:workspace-data page-id :objects])
ids (if (nil? ids) (get-in state [:workspace-local :selected]) ids)
shapes (mapv #(get-in state [:workspace-data page-id :objects %]) ids)
ids (if (nil? ids) (get-in state [:workspace-local :selected]) ids)
shapes (mapv #(get objects %) ids)
stopper (rx/filter ms/mouse-up? stream)
layout (get state :workspace-layout)]
layout (get state :workspace-layout)]
(rx/concat
(->> ms/mouse-position
(rx/take-until stopper)
(rx/map #(gpt/to-vec from-position %))
(rx/switch-map #(snap/closest-snap-move page-id shapes objects layout %))
(rx/map #(gpt/round % 0))
(rx/map gmt/translate-matrix)
(rx/map #(set-modifiers ids {:displacement %})))

View file

@ -23,7 +23,8 @@
(def ^:private snap-accuracy 5)
(def ^:private snap-distance-accuracy 10)
(defn- remove-from-snap-points [remove-id?]
(defn- remove-from-snap-points
[remove-id?]
(fn [query-result]
(->> query-result
(map (fn [[value data]] [value (remove (comp remove-id? second) data)]))
@ -57,12 +58,12 @@
:else zero)))
(defn get-snap-points [page-id frame-id filter-shapes point coord]
(let [value (coord point)]
(let [value (get point coord)]
(->> (uw/ask! {:cmd :snaps/range-query
:page-id page-id
:frame-id frame-id
:coord coord
:ranges [[(- value 1) (+ value 1)]]})
:ranges [[value value]]})
(rx/first)
(rx/map (remove-from-snap-points filter-shapes))
(rx/map flatten-to-points))))
@ -147,7 +148,8 @@
(if (mth/finite? min-snap) [0 min-snap] nil)))))))
(defn select-shapes-area [page-id shapes objects area-selrect]
(defn select-shapes-area
[page-id shapes objects area-selrect]
(->> (uw/ask! {:cmd :selection/query
:page-id page-id
:frame-id (->> shapes first :frame-id)
@ -155,13 +157,15 @@
(rx/map #(set/difference % (into #{} (map :id shapes))))
(rx/map (fn [ids] (map #(get objects %) ids)))))
(defn closest-distance-snap [page-id shapes objects movev]
(defn closest-distance-snap
[page-id shapes objects movev]
(->> (rx/of shapes)
(rx/map #(vector (->> % first :frame-id (get objects))
(-> % gsh/selection-rect (gsh/move movev))))
(rx/merge-map
(fn [[frame selrect]]
(let [areas (->> (gsh/selrect->areas (or (:selrect frame) (gsh/rect->rect-shape @refs/vbox)) selrect)
(let [areas (->> (gsh/selrect->areas (or (:selrect frame)
(gsh/rect->rect-shape @refs/vbox)) selrect)
(d/mapm #(select-shapes-area page-id shapes objects %2)))
snap-x (search-snap-distance selrect :x (:left areas) (:right areas))
snap-y (search-snap-distance selrect :y (:top areas) (:bottom areas))]
@ -178,8 +182,7 @@
(not (contains? layout :dynamic-alignment)))))]
(->> (closest-snap page-id frame-id [point] filter-shapes)
(rx/map #(or % (gpt/point 0 0)))
(rx/map #(gpt/add point %))
)))
(rx/map #(gpt/add point %)))))
(defn closest-snap-move
[page-id shapes objects layout movev]
@ -201,4 +204,7 @@
(closest-distance-snap page-id shapes objects movev)))
(rx/reduce gpt/min)
(rx/map #(or % (gpt/point 0 0)))
(rx/map #(gpt/add movev %)))))
(rx/map #(gpt/add movev %))
(rx/map #(gpt/round % 0))
)))

View file

@ -73,7 +73,6 @@
on-pos-x-change #(on-position-change % :x)
on-pos-y-change #(on-position-change % :y)
select-all #(-> % (dom/get-target) (.select))]
[:div.element-set
[:div.element-set-content

View file

@ -53,7 +53,7 @@
(get sr2 (if (= :x coord) :x1 :y1)))
distance (- to-c from-c)
distance-str (-> distance (mth/precision 2) str)
distance-str (-> distance (mth/precision 0) str)
half-point (half-point coord sr1 sr2)
width (-> distance-str
count
@ -80,7 +80,7 @@
:font-size (/ pill-text-font-size zoom)
:fill "white"
:text-anchor "middle"}
(mth/precision distance 2)]])
(mth/precision distance 0)]])
(let [p1 [(+ from-c (/ segment-gap zoom)) (+ half-point (/ segment-gap-side zoom))]
p2 [(+ from-c (/ segment-gap zoom)) (- half-point (/ segment-gap-side zoom))]
@ -110,7 +110,7 @@
pair->distance+pair
(fn [[sh1 sh2]]
[(-> (gsh/distance-shapes sh1 sh2) coord (mth/precision 2)) [sh1 sh2]])
[(-> (gsh/distance-shapes sh1 sh2) coord (mth/precision 0)) [sh1 sh2]])
contains-selected?
(fn [selected pairs]
@ -136,7 +136,7 @@
(->> (query-side lt-side)
(rx/combine-latest vector (query-side gt-side)))))
distance-to-selrect
(fn [shape]
(let [sr (:selrect shape)]
@ -144,11 +144,11 @@
(gsh/distance-selrect sr selrect)
(gsh/distance-selrect selrect sr))
coord
(mth/precision 2))))
(mth/precision 0))))
get-shapes-match
(fn [pred? shapes]
(->> shapes
(->> shapes
(sort-by coord)
(d/map-perm vector)
(filter (fn [[sh1 sh2]] (gsh/overlap-coord? coord sh1 sh2)))

View file

@ -9,7 +9,8 @@
(def ^:private line-color "#D383DA")
(mf/defc snap-point [{:keys [point zoom]}]
(mf/defc snap-point
[{:keys [point zoom]}]
(let [{:keys [x y]} point
cross-width (/ 3 zoom)]
[:g
@ -24,7 +25,8 @@
:y2 (- y cross-width)
:style {:stroke line-color :stroke-width (str (/ 1 zoom))}}]]))
(mf/defc snap-line [{:keys [snap point zoom]}]
(mf/defc snap-line
[{:keys [snap point zoom]}]
[:line {:x1 (:x snap)
:y1 (:y snap)
:x2 (:x point)
@ -32,7 +34,8 @@
:style {:stroke line-color :stroke-width (str (/ 1 zoom))}
:opacity 0.4}])
(defn get-snap [coord {:keys [shapes page-id filter-shapes]}]
(defn get-snap
[coord {:keys [shapes page-id filter-shapes]}]
(->> (rx/from shapes)
(rx/flat-map (fn [shape]
(->> (sp/shape-snap-points shape)
@ -50,10 +53,11 @@
;; We use sets to store points/lines so there are no points/lines repeated
;; can cause problems with react keys
snap-points (into #{} (mapcat (fn [[point snaps coord]]
(when (not-empty snaps) (concat [point] snaps))) @state))
(cons point snaps))
@state))
snap-lines (into #{} (mapcat (fn [[point snaps coord]]
(when (not-empty snaps) (map #(vector point %) snaps))) @state))]
(mf/use-effect
(fn []
(let [sub
@ -63,7 +67,7 @@
(get-snap :y %)
(get-snap :x %)))
(rx/subs #(reset! state %)))]
;; On unmount callback
#(rx/dispose! sub))))
@ -72,35 +76,36 @@
(fn []
(rx/push! subject props)))
[:g.snap-feedback
(for [[from-point to-point] snap-lines]
[:& snap-line {:key (str "line-" (:x from-point) "-" (:y from-point) "-" (:x to-point) "-" (:y to-point) "-")
[:& snap-line {:key (str "line-" (:x from-point)
"-" (:y from-point)
"-" (:x to-point)
"-" (:y to-point) "-")
:snap from-point
:point to-point
:zoom zoom}])
(for [point snap-points]
[:& snap-point {:key (str "point-" (:x point) "-" (:y point))
[:& snap-point {:key (str "point-" (:x point)
"-" (:y point))
:point point
:zoom zoom}])]))
(mf/defc snap-points [{:keys [layout]}]
(let [page-id (mf/deref refs/workspace-page-id)
selected (mf/deref refs/selected-shapes)
selected-shapes (mf/deref (refs/objects-by-id selected))
drawing (mf/deref refs/current-drawing-shape)
(mf/defc snap-points
{::mf/wrap [mf/memo]}
[{:keys [layout zoom selected page-id drawing transform] :as props}]
(let [shapes (mf/deref (refs/objects-by-id selected))
filter-shapes (mf/deref refs/selected-shapes-with-children)
filter-shapes (fn [id] (if (= id :layout)
(or (not (contains? layout :display-grid))
(not (contains? layout :snap-grid)))
(or (filter-shapes id)
(not (contains? layout :dynamic-alignment)))))
current-transform (mf/deref refs/current-transform)
snap-data (mf/deref refs/workspace-snap-data)
shapes (if drawing [drawing] selected-shapes)
zoom (mf/deref refs/selected-zoom)]
(when (or drawing current-transform)
filter-shapes (fn [id]
(if (= id :layout)
(or (not (contains? layout :display-grid))
(not (contains? layout :snap-grid)))
(or (filter-shapes id)
(not (contains? layout :dynamic-alignment)))))
;; current-transform (mf/deref refs/current-transform)
;; snap-data (mf/deref refs/workspace-snap-data)
shapes (if drawing [drawing] shapes)]
(when (or drawing transform)
[:& snap-feedback {:shapes shapes
:page-id page-id
:filter-shapes filter-shapes

View file

@ -50,7 +50,7 @@
(mf/defc coordinates
[]
(let [coords (some-> (hooks/use-rxsub ms/mouse-position)
(gpt/round 0))]
(gpt/round))]
[:ul.coordinates
[:span {:alt "x"}
(str "X: " (:x coords "-"))]
@ -290,12 +290,13 @@
]
(-> (gpt/subtract pt brect)
(gpt/divide (gpt/point @refs/selected-zoom))
(gpt/add box))))
(gpt/add box)
(gpt/round 0))))
on-mouse-move
(fn [event]
(let [event (.getBrowserEvent event)
pt (gpt/point (.-clientX event) (.-clientY event))
pt (dom/get-client-position event)
pt (translate-point-to-viewport pt)
delta (gpt/point (.-movementX event)
(.-movementY event))]
@ -457,7 +458,13 @@
(when (contains? layout :display-grid)
[:& frame-grid {:zoom zoom}])
[:& snap-points {:layout layout}]
[:& snap-points {:layout layout
:transform (:transform local)
:drawing (:drawing local)
:zoom zoom
:page-id (:id page)
:selected selected}]
[:& snap-distances {:layout layout}]
(when tooltip

View file

@ -28,6 +28,8 @@
[shape]
(let [shape (gsh/transform-shape shape)
shape-center (gsh/center shape)]
(case (:type shape)
:frame (-> shape gsh/shape->rect-shape frame-snap-points)
(into #{shape-center} (-> shape :points)))))
(if (= :frame (:type shape))
(-> shape
(gsh/shape->rect-shape)
(frame-snap-points))
(into #{shape-center} (:points shape)))))

View file

@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
@ -10,7 +10,7 @@
*/
/*
* Balanced Binary Search Tree based on the red-black BST
* Balanced Binary Search Tree based on the red-black BST
* described at "Algorithms" by Robert Sedwick & Kevin Wayne
*/
"use strict";
@ -27,7 +27,7 @@ goog.scope(function() {
RED: 1,
BLACK: 2
}
class Node {
constructor(value, data) {
this.value = value;
@ -37,7 +37,7 @@ goog.scope(function() {
this.color = Color.BLACK;
}
}
// Will store a map from key to list of data
// value => [ data ]
// The values can be queried in range and the data stored will be retrived whole
@ -46,13 +46,13 @@ goog.scope(function() {
constructor() {
this.root = null;
}
insert(value, data) {
this.root = recInsert(this.root, value, data);
this.root.color = Color.BLACK;
return this;
}
remove(value, data) {
if (!this.root) {
return this;
@ -76,16 +76,16 @@ goog.scope(function() {
return this;
}
update (value, oldData, newData) {
this.root = recUpdate(this.root, value, oldData, newData);
return this;
}
get(value) {
return recGet(this.root, value);
}
rangeQuery (fromValue, toValue) {
return recRangeQuery(this.root, fromValue, toValue, []);
}
@ -227,7 +227,7 @@ goog.scope(function() {
return recGet(branch.right, value);
}
}
function recUpdate(branch, value, oldData, newData) {
if (branch === null) {
return branch;

View file

@ -31,9 +31,9 @@
(map #(vector % (:id shape)) points))
;; The grid points are only added by the "root" of the coord-dat
(if (= (:id shape) frame-id)
(let [points (gg/grid-snap-points shape coord)]
(map #(vector % :layout) points))))))
(when (= (:id shape) frame-id)
(let [points (gg/grid-snap-points shape coord)]
(map #(vector % :layout) points))))))
into-tree (fn [tree [point _ :as data]]
(rt/insert tree (coord point) data))]
(->> shapes
@ -48,9 +48,10 @@
(group-by :frame-id))
frame-shapes (->> (cph/select-frames objects)
(reduce #(update %1 (:id %2) conj %2) frame-shapes))]
(d/mapm (fn [frame-id shapes] {:x (create-coord-data frame-id shapes :x)
:y (create-coord-data frame-id shapes :y)})
frame-shapes)))
:y (create-coord-data frame-id shapes :y)})
frame-shapes)))
(defn- log-state
"Helper function to print a friendly version of the snap tree. Debugging purposes"
@ -74,7 +75,7 @@
(index-page state id objects)))]
(swap! state #(reduce process-page % pages)))
#_(log-state)
;; (log-state)
;; Return nil so the worker will not answer anything back
nil)
@ -82,7 +83,7 @@
[{:keys [page-id objects] :as message}]
;; TODO: Check the difference and update the index acordingly
(swap! state index-page page-id objects)
#_(log-state)
;; (log-state)
nil)
(defmethod impl/handler :snaps/range-query
@ -96,3 +97,4 @@
set ;; unique
(into []))))

3
package-lock.json generated
View file

@ -1,3 +0,0 @@
{
"lockfileVersion": 1
}