♻️ Refactor pages namespaces

This commit is contained in:
alonso.torres 2020-12-10 13:56:33 +01:00 committed by Hirunatan
parent 83519e8513
commit 45882ba6a1
40 changed files with 1354 additions and 1247 deletions

View file

@ -6,24 +6,24 @@
(ns app.main.data.colors
(:require
[cljs.spec.alpha :as s]
[beicon.core :as rx]
[clojure.set :as set]
[potok.core :as ptk]
[app.main.streams :as ms]
[app.common.data :as d]
[app.common.pages :as cp]
[app.common.spec :as us]
[app.common.uuid :as uuid]
[app.main.data.modal :as md]
[app.main.data.workspace.common :as dwc]
[app.main.data.workspace.texts :as dwt]
[app.main.repo :as rp]
[app.main.store :as st]
[app.main.streams :as ms]
[app.util.color :as color]
[app.util.i18n :refer [tr]]
[app.util.router :as rt]
[app.util.time :as dt]
[app.common.uuid :as uuid]
[app.main.data.workspace.common :as dwc]
[app.main.data.workspace.texts :as dwt]
[app.main.data.modal :as md]
[app.common.pages-helpers :as cph]))
[beicon.core :as rx]
[cljs.spec.alpha :as s]
[clojure.set :as set]
[potok.core :as ptk]))
(def clear-color-for-rename
(ptk/reify ::clear-color-for-rename
@ -112,7 +112,7 @@
(let [pid (:current-page-id state)
objects (get-in state [:workspace-data :pages-index pid :objects])
not-frame (fn [shape-id] (not= (get-in objects [shape-id :type]) :frame))
children (->> ids (filter not-frame) (mapcat #(cph/get-children % objects)))
children (->> ids (filter not-frame) (mapcat #(cp/get-children % objects)))
ids (into ids children)
is-text? #(= :text (:type (get objects %)))
@ -141,7 +141,7 @@
(let [pid (:current-page-id state)
objects (get-in state [:workspace-data :pages-index pid :objects])
not-frame (fn [shape-id] (not= (get-in objects [shape-id :type]) :frame))
children (->> ids (filter not-frame) (mapcat #(cph/get-children % objects)))
children (->> ids (filter not-frame) (mapcat #(cp/get-children % objects)))
ids (into ids children)
update-fn (fn [s]

View file

@ -17,7 +17,6 @@
[app.common.geom.shapes :as geom]
[app.common.math :as mth]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.spec :as us]
[app.common.uuid :as uuid]
[app.config :as cfg]

View file

@ -12,7 +12,6 @@
[app.common.data :as d]
[app.common.exceptions :as ex]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.spec :as us]
[app.common.uuid :as uuid]
[app.main.constants :as c]
@ -388,7 +387,7 @@
(conj id))]
(-> state
(assoc-in [:viewer-local :selected]
(cph/expand-region-selection objects selection)))))))
(cp/expand-region-selection objects selection)))))))
(defn select-all
[]

View file

@ -18,7 +18,6 @@
[app.common.geom.align :as gal]
[app.common.math :as mth]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.spec :as us]
[app.common.uuid :as uuid]
[app.config :as cfg]
@ -346,7 +345,7 @@
(initialize [state local]
(let [page-id (:current-page-id state)
objects (dwc/lookup-page-objects state page-id)
shapes (cph/select-toplevel-shapes objects {:include-frames? true})
shapes (cp/select-toplevel-shapes objects {:include-frames? true})
srect (gsh/selection-rect shapes)
local (assoc local :vport size :zoom 1)]
(cond
@ -517,7 +516,7 @@
(update [_ state]
(let [page-id (:current-page-id state)
objects (dwc/lookup-page-objects state page-id)
shapes (cph/select-toplevel-shapes objects {:include-frames? true})
shapes (cp/select-toplevel-shapes objects {:include-frames? true})
srect (gsh/selection-rect shapes)]
(if (or (mth/nan? (:width srect))
@ -572,7 +571,7 @@
page-id (:current-page-id state)
frame-id (-> (dwc/lookup-page-objects state page-id)
(cph/frame-id-by-position {:x frame-x :y frame-y}))
(cp/frame-id-by-position {:x frame-x :y frame-y}))
shape (-> (cp/make-minimal-shape type)
(merge data)
@ -686,8 +685,8 @@
rchanges
(d/concat
(reduce (fn [res id]
(let [children (cph/get-children id objects)
parents (cph/get-parents id objects)
(let [children (cp/get-children id objects)
parents (cp/get-parents id objects)
del-change #(array-map
:type :del-obj
:page-id page-id
@ -713,15 +712,15 @@
uchanges
(d/concat
(reduce (fn [res id]
(let [children (cph/get-children id objects)
parents (cph/get-parents id objects)
(let [children (cp/get-children id objects)
parents (cp/get-parents id objects)
parent (get objects (first parents))
add-change (fn [id]
(let [item (get objects id)]
{:type :add-obj
:id (:id item)
:page-id page-id
:index (cph/position-on-parent id objects)
:index (cp/position-on-parent id objects)
:frame-id (:frame-id item)
:parent-id (:parent-id item)
:obj item}))]
@ -802,7 +801,7 @@
:frame-id (:frame-id obj)
:page-id page-id
:shapes [id]
:index (cph/position-on-parent id objects)}))
:index (cp/position-on-parent id objects)}))
selected)]
;; TODO: maybe missing the :reg-objects event?
(rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true}))))))
@ -826,7 +825,7 @@
(if (nil? ids)
(vec res)
(recur
(conj res (cph/get-parent (first ids) objects))
(conj res (cp/get-parent (first ids) objects))
(next ids))))
groups-to-unmask
@ -869,7 +868,7 @@
{:type :mov-objects
:parent-id (:parent-id obj)
:page-id page-id
:index (cph/position-on-parent id objects)
:index (cp/position-on-parent id objects)
:shapes [id]})))
[] (reverse ids))
[{:type :reg-objects
@ -1289,7 +1288,7 @@
[frame-id delta] (if (selected-frame? state)
[(first page-selected)
(get page-objects (first page-selected))]
[(cph/frame-id-by-position page-objects mouse-pos)
[(cp/frame-id-by-position page-objects mouse-pos)
(gpt/subtract mouse-pos orig-pos)])
objects (d/mapm (fn [_ v] (assoc v :frame-id frame-id :parent-id frame-id)) objects)
@ -1328,7 +1327,7 @@
height 16
page-id (:current-page-id state)
frame-id (-> (dwc/lookup-page-objects state page-id)
(cph/frame-id-by-position @ms/mouse-position))
(cp/frame-id-by-position @ms/mouse-position))
shape (gsh/setup-selrect
{:id id
:type :text

View file

@ -15,7 +15,6 @@
[potok.core :as ptk]
[app.common.data :as d]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.spec :as us]
[app.common.uuid :as uuid]
[app.main.worker :as uw]
@ -168,7 +167,7 @@
(defn get-frame-at-point
[objects point]
(let [frames (cph/select-frames objects)]
(let [frames (cp/select-frames objects)]
(d/seek #(gsh/has-point? % point) frames)))
@ -366,7 +365,7 @@
(let [expand-fn (fn [expanded]
(merge expanded
(->> ids
(map #(cph/get-parents % objects))
(map #(cp/get-parents % objects))
flatten
(filter #(not= % uuid/zero))
(map (fn [id] {id true}))
@ -423,7 +422,7 @@
(us/assert ::coll-of-uuid ids)
(us/assert fn? f)
(letfn [(impl-get-children [objects id]
(cons id (cph/get-children id objects)))
(cons id (cp/get-children id objects)))
(impl-gen-changes [objects page-id ids]
(loop [sids (seq ids)
@ -537,7 +536,7 @@
frame-id (if (= :frame (:type attrs))
uuid/zero
(or (:frame-id attrs)
(cph/frame-id-by-position objects attrs)))
(cp/frame-id-by-position objects attrs)))
shape (merge
(if (= :frame (:type shape))

View file

@ -14,7 +14,7 @@
[app.common.geom.point :as gpt]
[app.common.geom.shapes :as gsh]
[app.common.uuid :as uuid]
[app.common.pages-helpers :as cph]
[app.common.pages :as cp]
[app.main.data.workspace.common :as dwc]
[app.main.snap :as snap]
[app.main.streams :as ms]
@ -62,7 +62,7 @@
objects (dwc/lookup-page-objects state page-id)
layout (get state :workspace-layout)
frames (cph/select-frames objects)
frames (cp/select-frames objects)
fid (or (->> frames
(filter #(gsh/has-point? % initial))
first

View file

@ -3,7 +3,6 @@
[app.common.data :as d]
[app.common.geom.shapes :as gsh]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.main.data.workspace.common :as dwc]
[app.main.data.workspace.selection :as dws]
[beicon.core :as rx]
@ -14,7 +13,7 @@
(->> selected
(map #(get objects %))
(filter #(not= :frame (:type %)))
(map #(assoc % ::index (cph/position-on-parent (:id %) objects)))
(map #(assoc % ::index (cp/position-on-parent (:id %) objects)))
(sort-by ::index)))
(defn- make-group
@ -61,7 +60,7 @@
(defn prepare-remove-group
[page-id group objects]
(let [shapes (:shapes group)
parent-id (cph/get-parent (:id group) objects)
parent-id (cp/get-parent (:id group) objects)
parent (get objects parent-id)
index-in-parent (->> (:shapes parent)
(map-indexed vector)

View file

@ -12,7 +12,6 @@
[app.common.data :as d]
[app.common.spec :as us]
[app.common.uuid :as uuid]
[app.common.pages-helpers :as cph]
[app.common.geom.point :as gpt]
[app.common.geom.shapes :as geom]
[app.main.data.messages :as dm]
@ -303,7 +302,7 @@
(ptk/reify ::duplicate-component
ptk/WatchEvent
(watch [_ state stream]
(let [component (cph/get-component id
(let [component (cp/get-component id
nil
(get state :workspace-data)
nil)
@ -365,7 +364,7 @@
objects (dwc/lookup-page-objects state page-id)
unames (atom (dwc/retrieve-used-names objects))
frame-id (cph/frame-id-by-position objects (gpt/add orig-pos delta))
frame-id (cp/frame-id-by-position objects (gpt/add orig-pos delta))
update-new-shape
(fn [new-shape original-shape]
@ -405,7 +404,7 @@
(dissoc :component-root?))))
[new-shape new-shapes _]
(cph/clone-object component-shape
(cp/clone-object component-shape
nil
(get component :objects)
update-new-shape)
@ -440,7 +439,7 @@
(watch [_ state stream]
(let [page-id (:current-page-id state)
objects (dwc/lookup-page-objects state page-id)
shapes (cph/get-object-with-children id objects)
shapes (cp/get-object-with-children id objects)
rchanges (map (fn [obj]
{:type :mod-obj
@ -517,7 +516,7 @@
(log/info :msg "RESET-COMPONENT of shape" :id (str id))
(let [local-file (get state :workspace-data)
libraries (get state :workspace-libraries)
container (cph/get-container (get state :current-page-id)
container (cp/get-container (get state :current-page-id)
:page
local-file)
[rchanges uchanges]

View file

@ -12,7 +12,7 @@
[cljs.spec.alpha :as s]
[app.common.spec :as us]
[app.common.data :as d]
[app.common.pages-helpers :as cph]
[app.common.pages :as cph] ;; TODO: remove this namespace
[app.common.geom.point :as gpt]
[app.common.geom.shapes :as geom]
[app.common.pages :as cp]

View file

@ -187,7 +187,6 @@
(s/def ::version ::us/integer)
(s/def ::revn ::us/integer)
(s/def ::ordering ::us/integer)
(s/def ::metadata (s/nilable ::cp/metadata))
(s/def ::data ::cp/data)
(s/def ::file ::dd/file)

View file

@ -18,7 +18,6 @@
[app.common.geom.shapes :as geom]
[app.common.math :as mth]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.spec :as us]
[app.common.uuid :as uuid]
[app.main.data.workspace.common :as dwc]
@ -129,7 +128,7 @@
:pages-index page-id
:objects shape-id
:blocked] false)))]
(rx/of (->> (cph/select-toplevel-shapes objects)
(rx/of (->> (cp/select-toplevel-shapes objects)
(map :id)
(filter is-not-blocked)
(into lks/empty-linked-set)
@ -235,7 +234,7 @@
name (dwc/generate-unique-name names (:name obj))
renamed-obj (assoc obj :id id :name name)
moved-obj (geom/move renamed-obj delta)
frames (cph/select-frames objects)
frames (cp/select-frames objects)
parent-id (or parent-id frame-id)
children-changes

View file

@ -15,7 +15,6 @@
[app.common.geom.point :as gpt]
[app.common.geom.shapes :as gsh]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.spec :as us]
[app.main.data.workspace.common :as dwc]
[app.main.data.workspace.selection :as dws]
@ -242,7 +241,7 @@
(let [position @ms/mouse-position
page-id (:current-page-id state)
objects (dwc/lookup-page-objects state page-id)
frame-id (cph/frame-id-by-position objects position)
frame-id (cp/frame-id-by-position objects position)
moving-shapes (->> ids
(map #(get objects %))
@ -399,20 +398,12 @@
(update-in objects [shape-id :modifiers] #(merge % modifiers)))
;; ID's + Children but remove frame children if the flag is set to false
ids-with-children (concat ids (mapcat #(cph/get-children % objects)
ids-with-children (concat ids (mapcat #(cp/get-children % objects)
(filter not-frame-id? ids)))]
(d/update-in-when state [:workspace-data :pages-index page-id :objects]
#(reduce update-shape % ids-with-children)))))))
(defn rotation-modifiers [center shape angle]
(let [displacement (let [shape-center (gsh/center-shape shape)]
(-> (gmt/matrix)
(gmt/rotate angle center)
(gmt/rotate (- angle) shape-center)))]
{:rotation angle
:displacement displacement}))
;; Set-rotation is custom because applies different modifiers to each
;; shape adjusting their position.
@ -423,14 +414,14 @@
([delta-rotation shapes center]
(letfn [(rotate-shape [objects angle shape center]
(update-in objects [(:id shape) :modifiers] merge (rotation-modifiers center shape angle)))
(update-in objects [(:id shape) :modifiers] merge (gsh/rotation-modifiers center shape angle)))
(rotate-around-center [objects angle center shapes]
(reduce #(rotate-shape %1 angle %2 center) objects shapes))
(set-rotation [objects]
(let [id->obj #(get objects %)
get-children (fn [shape] (map id->obj (cph/get-children (:id shape) objects)))
get-children (fn [shape] (map id->obj (cp/get-children (:id shape) objects)))
shapes (concat shapes (mapcat get-children shapes))]
(rotate-around-center objects delta-rotation center shapes)))]
@ -452,7 +443,7 @@
objects1 (get-in state [:workspace-data :pages-index page-id :objects])
;; ID's + Children ID's
ids-with-children (d/concat [] (mapcat #(cph/get-children % objects1) ids) ids)
ids-with-children (d/concat [] (mapcat #(cp/get-children % objects1) ids) ids)
;; For each shape applies the modifiers by transforming the objects
update-shape #(update %1 %2 gsh/transform-shape)

View file

@ -14,7 +14,6 @@
[cuerdas.core :as str]
[app.common.uuid :as uuid]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.math :as mth]
[app.common.geom.shapes :as gsh]
[app.common.geom.align :as gal]
@ -43,7 +42,7 @@
(defn- calculate-dimensions
[{:keys [objects] :as data} vport]
(let [shapes (cph/select-toplevel-shapes objects {:include-frames? true})
(let [shapes (cp/select-toplevel-shapes objects {:include-frames? true})
to-finite (fn [val fallback] (if (not (mth/finite? val)) fallback val))
rect (->> (gsh/selection-rect shapes)
(gal/adjust-to-viewport vport))]
@ -144,7 +143,7 @@
frame-id (:id frame)
modifier-ids (concat [frame-id] (cph/get-children frame-id objects))
modifier-ids (concat [frame-id] (cp/get-children frame-id objects))
update-fn #(assoc-in %1 [%2 :modifiers :displacement] modifier)
objects (reduce update-fn objects modifier-ids)
frame (assoc-in frame [:modifiers :displacement] modifier)
@ -174,7 +173,7 @@
group-id (:id group)
modifier-ids (concat [group-id] (cph/get-children group-id objects))
modifier-ids (concat [group-id] (cp/get-children group-id objects))
update-fn #(assoc-in %1 [%2 :modifiers :displacement] modifier)
objects (reduce update-fn objects modifier-ids)
group (assoc-in group [:modifiers :displacement] modifier)

View file

@ -13,7 +13,6 @@
[beicon.core :as rx]
[okulary.core :as l]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.uuid :as uuid]
[app.main.constants :as c]
[app.main.store :as st]))
@ -142,7 +141,7 @@
(l/derived :options workspace-page))
(def workspace-frames
(l/derived cph/select-frames workspace-page-objects))
(l/derived cp/select-frames workspace-page-objects))
(defn object-by-id
[id]
@ -162,7 +161,7 @@
(let [page-id (:current-page-id state)
objects (get-in state [:workspace-data :pages-index page-id :objects])
selected (get-in state [:workspace-local :selected])
children (cph/get-children id objects)]
children (cp/get-children id objects)]
(some selected children)))]
(l/derived selector st/state)))
@ -181,7 +180,7 @@
(let [selected (get-in state [:workspace-local :selected])
page-id (:current-page-id state)
objects (get-in state [:workspace-data :pages-index page-id :objects])
children (mapcat #(cph/get-children % objects) selected)]
children (mapcat #(cp/get-children % objects) selected)]
(into selected children)))]
(l/derived selector st/state =)))
@ -192,7 +191,7 @@
(let [selected (get-in state [:workspace-local :selected])
page-id (:current-page-id state)
objects (get-in state [:workspace-data :pages-index page-id :objects])
children (mapcat #(cph/get-children % objects) selected)
children (mapcat #(cp/get-children % objects) selected)
shapes (into selected children)]
(mapv #(get objects %) shapes)))]
(l/derived selector st/state =)))

View file

@ -12,7 +12,7 @@
[potok.core :as ptk]
[cuerdas.core :as str]
[app.common.data :as d]
[app.common.pages-helpers :as cph]
[app.common.pages :as cp]
[app.common.uuid :as uuid]
[app.util.storage :refer [storage]]
[app.util.debug :refer [debug? debug-exclude-events logjs]]))
@ -119,7 +119,7 @@
(show-component [shape objects]
(if (nil? (:shape-ref shape))
""
(let [root-shape (cph/get-root-shape shape objects)
(let [root-shape (cp/get-root-shape shape objects)
component-id (when root-shape (:component-id root-shape))
component-file-id (when root-shape (:component-file root-shape))
component-file (when component-file-id (get libraries component-file-id))

View file

@ -15,7 +15,6 @@
[app.util.dom :as dom]
[app.common.data :as d]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.geom.matrix :as gmt]
[app.common.geom.point :as gpt]
[app.common.geom.shapes :as geom]
@ -141,7 +140,7 @@
(gmt/translate-matrix))
update-fn #(assoc-in %1 [%2 :modifiers :displacement] modifier)
modifier-ids (d/concat [frame-id] (cph/get-children frame-id objects))]
modifier-ids (d/concat [frame-id] (cp/get-children frame-id objects))]
(reduce update-fn objects modifier-ids)))
(defn make-vbox [frame]

View file

@ -14,7 +14,6 @@
[rumext.alpha :as mf]
[app.common.uuid :as uuid]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.math :as mth]
[app.common.geom.shapes :as geom]
[app.common.geom.point :as gpt]
@ -34,7 +33,7 @@
(gpt/negate)
(gmt/translate-matrix))
mod-ids (cons frame-id (cph/get-children frame-id objects))
mod-ids (cons frame-id (cp/get-children frame-id objects))
updt-fn #(-> %1
(assoc-in [%2 :modifiers :displacement] modifier)
(update %2 geom/transform-shape))
@ -82,7 +81,7 @@
[objects object-id]
(if (uuid/zero? object-id)
(let [object (get objects object-id)
shapes (cph/select-toplevel-shapes objects {:include-frames? true})
shapes (cp/select-toplevel-shapes objects {:include-frames? true})
srect (geom/selection-rect shapes)
object (merge object (select-keys srect [:x :y :width :height]))
object (geom/transform-shape object)

View file

@ -14,7 +14,7 @@
[app.common.geom.matrix :as gmt]
[app.common.geom.point :as gpt]
[app.common.geom.shapes :as geom]
[app.common.pages-helpers :as cph]
[app.common.pages :as cp]
[app.main.data.viewer :as dv]
[app.main.data.comments :as dcm]
[app.main.refs :as refs]
@ -143,7 +143,7 @@
update-fn #(assoc-in %1 [%2 :modifiers :displacement] modifier)
objects (->> (d/concat [frame-id] (cph/get-children frame-id objects))
objects (->> (d/concat [frame-id] (cp/get-children frame-id objects))
(reduce update-fn objects))
interactions? (:interactions-show? state)

View file

@ -13,7 +13,6 @@
[rumext.alpha :as mf]
[app.common.data :as d]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.main.data.viewer :as dv]
[app.main.refs :as refs]
[app.main.store :as st]
@ -174,7 +173,7 @@
update-fn #(assoc-in %1 [%2 :modifiers :displacement] modifier)
frame-id (:id frame)
modifier-ids (d/concat [frame-id] (cph/get-children frame-id objects))
modifier-ids (d/concat [frame-id] (cp/get-children frame-id objects))
objects (reduce update-fn objects modifier-ids)
frame (assoc-in frame [:modifiers :displacement] modifier)

View file

@ -14,7 +14,6 @@
[app.common.geom.shapes :as geom]
[app.common.media :as cm]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.uuid :as uuid]
[app.config :as cfg]
[app.main.data.colors :as dc]

View file

@ -11,7 +11,6 @@
(:require
[app.common.data :as d]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.uuid :as uuid]
[app.main.data.workspace :as dw]
[app.main.data.workspace.common :as dwc]
@ -168,7 +167,7 @@
(if (= side :center)
(st/emit! (dw/relocate-selected-shapes (:id item) 0))
(let [to-index (if (= side :top) (inc index) index)
parent-id (cph/get-parent (:id item) objects)]
parent-id (cp/get-parent (:id item) objects)]
(st/emit! (dw/relocate-selected-shapes parent-id to-index)))))
on-hold
@ -245,7 +244,7 @@
old-obs (unchecked-get oprops "objects")]
(and (= new-itm old-itm)
(identical? new-idx old-idx)
(let [childs (cph/get-children (:id new-itm) new-obs)
(let [childs (cp/get-children (:id new-itm) new-obs)
childs' (conj childs (:id new-itm))]
(and (or (= new-sel old-sel)
(not (or (boolean (some new-sel childs'))

View file

@ -10,7 +10,7 @@
(ns app.main.ui.workspace.sidebar.options.component
(:require
[rumext.alpha :as mf]
[app.common.pages-helpers :as cph]
[app.common.pages :as cp]
[app.main.refs :as refs]
[app.main.store :as st]
[app.main.ui.icons :as i]
@ -32,10 +32,10 @@
show? (some? (:component-id values))
local-library (mf/deref refs/workspace-local-library)
libraries (mf/deref refs/workspace-libraries)
component (cph/get-component (:component-id values)
(:component-file values)
local-library
libraries)
component (cp/get-component (:component-id values)
(:component-file values)
local-library
libraries)
on-menu-click (mf/use-callback
(fn [event]

View file

@ -13,7 +13,6 @@
[rumext.alpha :as mf]
[app.common.attrs :as attrs]
[app.common.geom.shapes :as geom]
[app.common.pages-helpers :as cph]
[app.main.refs :as refs]
[app.main.data.workspace.texts :as dwt]
[app.main.ui.workspace.sidebar.options.multiple :refer [get-shape-attrs]]

View file

@ -11,7 +11,7 @@
(:require
[rumext.alpha :as mf]
[app.common.data :as d]
[app.common.pages-helpers :as cph]
[app.common.pages :as cp]
[app.main.data.workspace :as dw]
[app.main.refs :as refs]
[app.main.store :as st]
@ -32,7 +32,7 @@
destination (get objects (:destination interaction))
frames (mf/use-memo (mf/deps objects)
#(cph/select-frames objects))
#(cp/select-frames objects))
show-frames-dropdown? (mf/use-state false)

View file

@ -15,7 +15,6 @@
[app.common.exceptions :as ex]
[app.common.geom.shapes :as geom]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.spec :as us]
[app.common.uuid :as uuid]
[app.util.quadtree :as qdt]
@ -65,7 +64,7 @@
(defn- create-index
[objects]
(let [shapes (cph/select-toplevel-shapes objects {:include-frames? true})
(let [shapes (cp/select-toplevel-shapes objects {:include-frames? true})
bounds (geom/selection-rect shapes)
bounds #js {:x (:x bounds)
:y (:y bounds)

View file

@ -12,7 +12,6 @@
[okulary.core :as l]
[app.common.uuid :as uuid]
[app.common.pages :as cp]
[app.common.pages-helpers :as cph]
[app.common.data :as d]
[app.worker.impl :as impl]
[app.util.range-tree :as rt]
@ -46,7 +45,7 @@
(let [frame-shapes (->> (vals objects)
(filter :frame-id)
(group-by :frame-id))
frame-shapes (->> (cph/select-frames objects)
frame-shapes (->> (cp/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)