Merge pull request #2802 from penpot/alotor-polishing-6

Polishing after confluence test
This commit is contained in:
Eva Marco 2023-01-19 12:55:59 +01:00 committed by GitHub
commit fe77ef4438
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 177 additions and 117 deletions

View File

@ -359,7 +359,7 @@
to-reflow to-reflow
(cond-> to-reflow (cond-> to-reflow
(and (ctl/layout-child-id? objects current) (and (ctl/layout-descent? objects parent-base)
(not= uuid/zero (:frame-id parent-base))) (not= uuid/zero (:frame-id parent-base)))
(conj (:frame-id parent-base)))] (conj (:frame-id parent-base)))]
(recur modif-tree (recur modif-tree
@ -389,8 +389,8 @@
(set-objects-modifiers nil modif-tree objects params)) (set-objects-modifiers nil modif-tree objects params))
([old-modif-tree modif-tree objects ([old-modif-tree modif-tree objects
{:keys [ignore-constraints snap-pixel? snap-precision] {:keys [ignore-constraints snap-pixel? snap-precision snap-ignore-axis]
:or {ignore-constraints false snap-pixel? false snap-precision 1}}] :or {ignore-constraints false snap-pixel? false snap-precision 1 snap-ignore-axis nil}}]
(let [objects (-> objects (let [objects (-> objects
(cond-> (some? old-modif-tree) (cond-> (some? old-modif-tree)
(apply-structure-modifiers old-modif-tree)) (apply-structure-modifiers old-modif-tree))
@ -398,7 +398,7 @@
modif-tree modif-tree
(cond-> modif-tree (cond-> modif-tree
snap-pixel? (gpp/adjust-pixel-precision objects snap-precision)) snap-pixel? (gpp/adjust-pixel-precision objects snap-precision snap-ignore-axis))
bounds (d/lazy-map (keys objects) #(dm/get-in objects [% :points])) bounds (d/lazy-map (keys objects) #(dm/get-in objects [% :points]))
bounds (cond-> bounds bounds (cond-> bounds

View File

@ -39,16 +39,25 @@
(ctm/resize scalev origin transform transform-inverse {:precise? true})))) (ctm/resize scalev origin transform transform-inverse {:precise? true}))))
(defn position-pixel-precision (defn position-pixel-precision
[modifiers _ points precision] [modifiers _ points precision ignore-axis]
(let [bounds (gpr/bounds->rect points) (let [bounds (gpr/bounds->rect points)
corner (gpt/point bounds) corner (gpt/point bounds)
target-corner (gpt/round-step corner precision) target-corner
(cond-> corner
(= ignore-axis :x)
(update :y mth/round precision)
(= ignore-axis :y)
(update :x mth/round precision)
(nil? ignore-axis)
(gpt/round-step precision))
deltav (gpt/to-vec corner target-corner)] deltav (gpt/to-vec corner target-corner)]
(ctm/move modifiers deltav))) (ctm/move modifiers deltav)))
(defn set-pixel-precision (defn set-pixel-precision
"Adjust modifiers so they adjust to the pixel grid" "Adjust modifiers so they adjust to the pixel grid"
[modifiers shape precision] [modifiers shape precision ignore-axis]
(let [points (-> shape :points (gco/transform-points (ctm/modifiers->transform modifiers))) (let [points (-> shape :points (gco/transform-points (ctm/modifiers->transform modifiers)))
has-resize? (not (ctm/only-move? modifiers)) has-resize? (not (ctm/only-move? modifiers))
@ -63,16 +72,16 @@
(gco/transform-points (ctm/modifiers->transform modifiers)) ) (gco/transform-points (ctm/modifiers->transform modifiers)) )
points)] points)]
[modifiers points])] [modifiers points])]
(position-pixel-precision modifiers shape points precision))) (position-pixel-precision modifiers shape points precision ignore-axis)))
(defn adjust-pixel-precision (defn adjust-pixel-precision
[modif-tree objects precision] [modif-tree objects precision ignore-axis]
(let [update-modifiers (let [update-modifiers
(fn [modif-tree shape] (fn [modif-tree shape]
(let [modifiers (dm/get-in modif-tree [(:id shape) :modifiers])] (let [modifiers (dm/get-in modif-tree [(:id shape) :modifiers])]
(cond-> modif-tree (cond-> modif-tree
(ctm/has-geometry? modifiers) (ctm/has-geometry? modifiers)
(update-in [(:id shape) :modifiers] set-pixel-precision shape precision))))] (update-in [(:id shape) :modifiers] set-pixel-precision shape precision ignore-axis))))]
(->> (keys modif-tree) (->> (keys modif-tree)
(map (d/getf objects)) (map (d/getf objects))

View File

@ -6,6 +6,7 @@
(ns app.common.types.shape.layout (ns app.common.types.shape.layout
(:require (:require
[app.common.data.macros :as dm]
[app.common.spec :as us] [app.common.spec :as us]
[clojure.spec.alpha :as s])) [clojure.spec.alpha :as s]))
@ -99,15 +100,21 @@
([shape] ([shape]
(and (= :frame (:type shape)) (= :flex (:layout shape))))) (and (= :frame (:type shape)) (= :flex (:layout shape)))))
(defn layout-child? [objects shape] (defn layout-immediate-child? [objects shape]
(let [parent-id (:parent-id shape)
parent (get objects parent-id)]
(layout? parent)))
(defn layout-immediate-child-id? [objects id]
(let [parent-id (dm/get-in objects [id :parent-id])
parent (get objects parent-id)]
(layout? parent)))
(defn layout-descent? [objects shape]
(let [frame-id (:frame-id shape) (let [frame-id (:frame-id shape)
frame (get objects frame-id)] frame (get objects frame-id)]
(layout? frame))) (layout? frame)))
(defn layout-child-id? [objects id]
(let [shape (get objects id)]
(layout-child? objects shape)))
(defn inside-layout? (defn inside-layout?
"Check if the shape is inside a layout" "Check if the shape is inside a layout"
[objects shape] [objects shape]

View File

@ -846,8 +846,8 @@
:text :text
(rx/of (dwe/start-edition-mode id)) (rx/of (dwe/start-edition-mode id))
(:group :bool) (:group :bool :frame)
(rx/of (dws/select-shapes (into (d/ordered-set) [(last shapes)]))) (rx/of (dws/select-shapes (into (d/ordered-set) shapes)))
:svg-raw :svg-raw
nil nil

View File

@ -219,7 +219,7 @@
result result
(let [[id text-modifier] (first modifiers)] (let [[id text-modifier] (first modifiers)]
(recur (rest modifiers) (recur (rest modifiers)
(update objects id apply-text-modifier text-modifier)))))) (update result id apply-text-modifier text-modifier))))))
#_(defn apply-path-modifiers #_(defn apply-path-modifiers
[objects path-modifiers] [objects path-modifiers]
@ -241,6 +241,9 @@
(calculate-modifiers state false false modif-tree)) (calculate-modifiers state false false modif-tree))
([state ignore-constraints ignore-snap-pixel modif-tree] ([state ignore-constraints ignore-snap-pixel modif-tree]
(calculate-modifiers state ignore-constraints ignore-snap-pixel modif-tree nil))
([state ignore-constraints ignore-snap-pixel modif-tree params]
(let [objects (let [objects
(wsh/lookup-page-objects state) (wsh/lookup-page-objects state)
@ -253,7 +256,11 @@
(as-> objects $ (as-> objects $
(apply-text-modifiers $ (get state :workspace-text-modifier)) (apply-text-modifiers $ (get state :workspace-text-modifier))
;;(apply-path-modifiers $ (get-in state [:workspace-local :edit-path])) ;;(apply-path-modifiers $ (get-in state [:workspace-local :edit-path]))
(gsh/set-objects-modifiers modif-tree $ {:ignore-constraints ignore-constraints :snap-pixel? snap-pixel? :snap-precision snap-precision}))))) (gsh/set-objects-modifiers modif-tree $ (merge
params
{:ignore-constraints ignore-constraints
:snap-pixel? snap-pixel?
:snap-precision snap-precision}))))))
(defn- calculate-update-modifiers (defn- calculate-update-modifiers
[old-modif-tree state ignore-constraints ignore-snap-pixel modif-tree] [old-modif-tree state ignore-constraints ignore-snap-pixel modif-tree]
@ -292,10 +299,13 @@
(set-modifiers modif-tree ignore-constraints false)) (set-modifiers modif-tree ignore-constraints false))
([modif-tree ignore-constraints ignore-snap-pixel] ([modif-tree ignore-constraints ignore-snap-pixel]
(set-modifiers modif-tree ignore-constraints ignore-snap-pixel nil))
([modif-tree ignore-constraints ignore-snap-pixel params]
(ptk/reify ::set-modifiers (ptk/reify ::set-modifiers
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
(assoc state :workspace-modifiers (calculate-modifiers state ignore-constraints ignore-snap-pixel modif-tree)))))) (assoc state :workspace-modifiers (calculate-modifiers state ignore-constraints ignore-snap-pixel modif-tree params))))))
;; Rotation use different algorithm to calculate children modifiers (and do not use child constraints). ;; Rotation use different algorithm to calculate children modifiers (and do not use child constraints).
(defn set-rotation-modifiers (defn set-rotation-modifiers

View File

@ -279,11 +279,14 @@
state))) state)))
ptk/WatchEvent ptk/WatchEvent
(watch [_ _ _] (watch [_ state _]
(rx/of (setup-frame-path) (let [content (get-in state [:workspace-drawing :object :content] [])]
(dwdc/handle-finish-drawing) (if (seq content)
(dwe/start-edition-mode shape-id) (rx/of (setup-frame-path)
(change-edit-mode :draw))))) (dwdc/handle-finish-drawing)
(dwe/start-edition-mode shape-id)
(change-edit-mode :draw))
(rx/of (dwdc/handle-finish-drawing)))))))
(defn handle-new-shape (defn handle-new-shape
"Creates a new path shape" "Creates a new path shape"

View File

@ -15,7 +15,6 @@
[app.common.pages.helpers :as cph] [app.common.pages.helpers :as cph]
[app.common.text :as txt] [app.common.text :as txt]
[app.common.types.modifiers :as ctm] [app.common.types.modifiers :as ctm]
[app.common.uuid :as uuid]
[app.main.data.workspace.changes :as dch] [app.main.data.workspace.changes :as dch]
[app.main.data.workspace.common :as dwc] [app.main.data.workspace.common :as dwc]
[app.main.data.workspace.modifiers :as dwm] [app.main.data.workspace.modifiers :as dwm]
@ -318,16 +317,25 @@
(defn not-changed? [old-dim new-dim] (defn not-changed? [old-dim new-dim]
(> (mth/abs (- old-dim new-dim)) 1)) (> (mth/abs (- old-dim new-dim)) 1))
(defn resize-text (defn commit-resize-text
[id new-width new-height] []
(ptk/reify ::resize-text (ptk/reify ::commit-resize-text
ptk/WatchEvent ptk/WatchEvent
(watch [_ state _] (watch [_ state _]
(let [shape (wsh/lookup-shape state id) (let [props (::resize-text-debounce-props state)
objects (wsh/lookup-page-objects state)
undo-id (js/Symbol)] undo-id (js/Symbol)]
(letfn [(update-fn [shape]
(let [{:keys [selrect grow-type]} shape (letfn [(changed-text? [id]
{shape-width :width shape-height :height} selrect (let [shape (get objects id)
[new-width new-height] (get props id)]
(or (and (not-changed? (:width shape) new-width) (= (:grow-type shape) :auto-width))
(and (not-changed? (:height shape) new-height)
(or (= (:grow-type shape) :auto-height) (= (:grow-type shape) :auto-width))))))
(update-fn [{:keys [id selrect grow-type] :as shape}]
(let [{shape-width :width shape-height :height} selrect
[new-width new-height] (get props id)
shape shape
(cond-> shape (cond-> shape
@ -342,14 +350,39 @@
shape))] shape))]
(when (or (and (not-changed? (:width shape) new-width) (= (:grow-type shape) :auto-width)) (let [ids (->> (keys props) (filter changed-text?))]
(and (not-changed? (:height shape) new-height)
(or (= (:grow-type shape) :auto-height) (= (:grow-type shape) :auto-width))))
(rx/of (dwu/start-undo-transaction undo-id) (rx/of (dwu/start-undo-transaction undo-id)
(dch/update-shapes [id] update-fn {:reg-objects? true :save-undo? true}) (dch/update-shapes ids update-fn {:reg-objects? true :save-undo? true})
(ptk/data-event :layout/update [id]) (ptk/data-event :layout/update ids)
(dwu/commit-undo-transaction undo-id)))))))) (dwu/commit-undo-transaction undo-id))))))))
(defn resize-text
[id new-width new-height]
(let [cur-event (js/Symbol)]
(ptk/reify ::resize-text
ptk/UpdateEvent
(update [_ state]
(-> state
(update ::resize-text-debounce-props (fnil assoc {}) id [new-width new-height])
(cond-> (nil? (::resize-text-debounce-event state))
(assoc ::resize-text-debounce-event cur-event))))
ptk/WatchEvent
(watch [_ state stream]
(if (= (::resize-text-debounce-event state) cur-event)
(let [stopper (->> stream (rx/filter (ptk/type? :app.main.data.workspace/finalize)))]
(rx/concat
(rx/merge
(->> stream
(rx/filter (ptk/type? ::resize-text))
(rx/debounce 50)
(rx/take 1)
(rx/map #(commit-resize-text))
(rx/take-until stopper))
(rx/of (resize-text id new-width new-height)))
(rx/of #(dissoc % ::resize-text-debounce-props ::resize-text-debounce-event))))
(rx/empty))))))
(defn save-font (defn save-font
[data] [data]
@ -384,37 +417,43 @@
new-shape)) new-shape))
(defn update-text-modifier-state (defn commit-update-text-modifier
[id props] []
(ptk/reify ::update-text-modifier-state (ptk/reify ::commit-update-text-modifier
ptk/UpdateEvent ptk/WatchEvent
(update [_ state] (watch [_ state _]
(update-in state [:workspace-text-modifier id] (fnil merge {}) props)))) (let [ids (::update-text-modifier-debounce-ids state)]
(let [modif-tree (dwm/create-modif-tree ids (ctm/reflow-modifiers))]
(rx/of (dwm/update-modifiers modif-tree false true)))))))
(defn update-text-modifier (defn update-text-modifier
[id props] [id props]
(ptk/reify ::update-text-modifier
ptk/WatchEvent
(watch [_ state _]
(let [modifiers (get-in (:workspace-modifiers state) [id :modifiers])
shape (-> (wsh/lookup-shape state id) (let [cur-event (js/Symbol)]
(gsh/transform-shape modifiers)) (ptk/reify ::update-text-modifier
ptk/UpdateEvent
(update [_ state]
(-> state
(update-in [:workspace-text-modifier id] (fnil merge {}) props)
(update ::update-text-modifier-debounce-ids (fnil conj #{}) id)
(cond-> (nil? (::update-text-modifier-debounce-event state))
(assoc ::update-text-modifier-debounce-event cur-event))))
current-width (:width shape) ptk/WatchEvent
current-height (:height shape)] (watch [_ state stream]
(rx/concat (if (= (::update-text-modifier-debounce-event state) cur-event)
(rx/of (update-text-modifier-state id props)) (let [stopper (->> stream (rx/filter (ptk/type? :app.main.data.workspace/finalize)))]
(rx/concat
(if (or (and (some? (:width props)) (rx/merge
(not (mth/close? (:width props) current-width))) (->> stream
(and (some? (:height props)) (rx/filter (ptk/type? ::update-text-modifier))
(not (mth/close? (:height props) current-height)))) (rx/debounce 50)
(rx/take 1)
(let [modif-tree (dwm/create-modif-tree [id] (ctm/reflow-modifiers))] (rx/map #(commit-update-text-modifier))
(->> (rx/of (dwm/update-modifiers modif-tree false true)) (rx/take-until stopper))
(rx/observe-on :async))) (rx/of (update-text-modifier id props)))
(rx/empty))))))) (rx/of #(dissoc % ::update-text-modifier-debounce-event ::update-text-modifier-debounce-ids))))
(rx/empty))))))
(defn clean-text-modifier (defn clean-text-modifier
[id] [id]
@ -464,18 +503,18 @@
(defn update-position-data (defn update-position-data
[id position-data] [id position-data]
(let [start (uuid/next)] (let [cur-event (js/Symbol)]
(ptk/reify ::update-position-data (ptk/reify ::update-position-data
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
(let [state (assoc-in state [:workspace-text-modifier id :position-data] position-data)] (let [state (assoc-in state [:workspace-text-modifier id :position-data] position-data)]
(if (nil? (::update-position-data-debounce state)) (if (nil? (::update-position-data-debounce state))
(assoc state ::update-position-data-debounce start) (assoc state ::update-position-data-debounce cur-event)
(assoc-in state [::update-position-data id] position-data)))) (assoc-in state [::update-position-data id] position-data))))
ptk/WatchEvent ptk/WatchEvent
(watch [_ state stream] (watch [_ state stream]
(if (= (::update-position-data-debounce state) start) (if (= (::update-position-data-debounce state) cur-event)
(let [stopper (->> stream (rx/filter (ptk/type? :app.main.data.workspace/finalize)))] (let [stopper (->> stream (rx/filter (ptk/type? :app.main.data.workspace/finalize)))]
(rx/merge (rx/merge
(->> stream (->> stream

View File

@ -440,21 +440,11 @@
exclude-frames-siblings exclude-frames-siblings
(into exclude-frames (into exclude-frames
(comp (mapcat (partial cph/get-siblings-ids objects)) (comp (mapcat (partial cph/get-siblings-ids objects))
(filter (partial ctl/layout-child-id? objects))) (filter (partial ctl/layout-immediate-child-id? objects)))
selected) selected)
fix-axis
(fn [[position shift?]]
(let [delta (gpt/to-vec from-position position)]
(if shift?
(if (> (mth/abs (:x delta)) (mth/abs (:y delta)))
(gpt/point (:x delta) 0)
(gpt/point 0 (:y delta)))
delta)))
position (->> ms/mouse-position position (->> ms/mouse-position
(rx/with-latest-from ms/mouse-position-shift) (rx/map #(gpt/to-vec from-position %)))
(rx/map #(fix-axis %)))
snap-delta (rx/concat snap-delta (rx/concat
;; We send the nil first so the stream is not waiting for the first value ;; We send the nil first so the stream is not waiting for the first value
@ -491,11 +481,24 @@
(rx/merge (rx/merge
;; Temporary modifiers stream ;; Temporary modifiers stream
(->> move-stream (->> move-stream
(rx/with-latest-from ms/mouse-position-shift)
(rx/map (rx/map
(fn [[move-vector target-frame drop-index]] (fn [[[move-vector target-frame drop-index] shift?]]
(-> (dwm/create-modif-tree ids (ctm/move-modifiers move-vector)) (let [x-disp? (> (mth/abs (:x move-vector)) (mth/abs (:y move-vector)))
(dwm/build-change-frame-modifiers objects selected target-frame drop-index) [move-vector snap-ignore-axis]
(dwm/set-modifiers))))) (cond
(and shift? x-disp?)
[(assoc move-vector :y 0) :y]
shift?
[(assoc move-vector :x 0) :x]
:else
[move-vector nil])]
(-> (dwm/create-modif-tree ids (ctm/move-modifiers move-vector))
(dwm/build-change-frame-modifiers objects selected target-frame drop-index)
(dwm/set-modifiers false false {:snap-ignore-axis snap-ignore-axis}))))))
(->> move-stream (->> move-stream
(rx/map (comp set-ghost-displacement first))) (rx/map (comp set-ghost-displacement first)))
@ -640,7 +643,7 @@
(let [objects (wsh/lookup-page-objects state) (let [objects (wsh/lookup-page-objects state)
selected (wsh/lookup-selected state {:omit-blocked? true}) selected (wsh/lookup-selected state {:omit-blocked? true})
selected-shapes (->> selected (map (d/getf objects)))] selected-shapes (->> selected (map (d/getf objects)))]
(if (every? (partial ctl/layout-child? objects) selected-shapes) (if (every? (partial ctl/layout-immediate-child-id? objects) selected-shapes)
(rx/of (reorder-selected-layout-child direction)) (rx/of (reorder-selected-layout-child direction))
(rx/of (nudge-selected-shapes direction shift?))))))) (rx/of (nudge-selected-shapes direction shift?)))))))
@ -750,36 +753,22 @@
(ptk/reify ::flip-horizontal-selected (ptk/reify ::flip-horizontal-selected
ptk/WatchEvent ptk/WatchEvent
(watch [_ state _] (watch [_ state _]
(let [objects (wsh/lookup-page-objects state) (let [objects (wsh/lookup-page-objects state)
selected (wsh/lookup-selected state {:omit-blocked? true}) selected (wsh/lookup-selected state {:omit-blocked? true})
shapes (map #(get objects %) selected) shapes (map #(get objects %) selected)
selrect (gsh/selection-rect shapes) selrect (gsh/selection-rect shapes)
origin (gpt/point (:x selrect) (+ (:y selrect) (/ (:height selrect) 2))) center (gsh/center-selrect selrect)
modifiers (dwm/create-modif-tree selected (ctm/resize-modifiers (gpt/point -1.0 1.0) center))]
modif-tree (dwm/create-modif-tree (rx/of (dwm/apply-modifiers {:modifiers modifiers}))))))
selected
(-> (ctm/empty)
(ctm/resize (gpt/point -1.0 1.0) origin)
(ctm/move (gpt/point (:width selrect) 0))))]
(rx/of (dwm/set-modifiers modif-tree true)
(dwm/apply-modifiers))))))
(defn flip-vertical-selected [] (defn flip-vertical-selected []
(ptk/reify ::flip-vertical-selected (ptk/reify ::flip-vertical-selected
ptk/WatchEvent ptk/WatchEvent
(watch [_ state _] (watch [_ state _]
(let [objects (wsh/lookup-page-objects state) (let [objects (wsh/lookup-page-objects state)
selected (wsh/lookup-selected state {:omit-blocked? true}) selected (wsh/lookup-selected state {:omit-blocked? true})
shapes (map #(get objects %) selected) shapes (map #(get objects %) selected)
selrect (gsh/selection-rect shapes) selrect (gsh/selection-rect shapes)
origin (gpt/point (+ (:x selrect) (/ (:width selrect) 2)) (:y selrect)) center (gsh/center-selrect selrect)
modifiers (dwm/create-modif-tree selected (ctm/resize-modifiers (gpt/point 1.0 -1.0) center))]
modif-tree (dwm/create-modif-tree (rx/of (dwm/apply-modifiers {:modifiers modifiers}))))))
selected
(-> (ctm/empty)
(ctm/resize (gpt/point 1.0 -1.0) origin)
(ctm/move (gpt/point 0 (:height selrect)))))]
(rx/of (dwm/set-modifiers modif-tree true)
(dwm/apply-modifiers))))))

View File

@ -402,7 +402,7 @@
(let [objects (wsh/lookup-page-objects state)] (let [objects (wsh/lookup-page-objects state)]
(into [] (into []
(comp (map (d/getf objects)) (comp (map (d/getf objects))
(filter (partial ctl/layout-child? objects))) (filter (partial ctl/layout-immediate-child? objects)))
ids))) ids)))
st/state =)) st/state =))
@ -481,7 +481,7 @@
(fn [objects] (fn [objects]
(->> ids (->> ids
(map (d/getf objects)) (map (d/getf objects))
(some (partial ctl/layout-child? objects)))) (some (partial ctl/layout-immediate-child? objects))))
workspace-page-objects)) workspace-page-objects))
(defn get-flex-child-viewer (defn get-flex-child-viewer
@ -491,7 +491,7 @@
(let [objects (wsh/lookup-viewer-objects state page-id)] (let [objects (wsh/lookup-viewer-objects state page-id)]
(into [] (into []
(comp (map (d/getf objects)) (comp (map (d/getf objects))
(filter (partial ctl/layout-child? objects))) (filter (partial ctl/layout-immediate-child? objects)))
ids))) ids)))
st/state =)) st/state =))

View File

@ -183,6 +183,9 @@
(dom/remove-attribute! node "data-old-width") (dom/remove-attribute! node "data-old-width")
(dom/remove-attribute! node "data-old-height")) (dom/remove-attribute! node "data-old-height"))
(dom/class? node "frame-title")
(dom/remove-attribute! node "data-old-transform")
:else :else
(let [old-transform (dom/get-attribute node "data-old-transform")] (let [old-transform (dom/get-attribute node "data-old-transform")]
(if (some? old-transform) (if (some? old-transform)

View File

@ -82,7 +82,7 @@
grid-y-data (get-grids-snap-points frame :y)] grid-y-data (get-grids-snap-points frame :y)]
(cond-> page-data (cond-> page-data
(not (ctl/layout-child? objects frame)) (not (ctl/layout-descent? objects frame))
(-> ;; Update root frame information (-> ;; Update root frame information
(assoc-in [uuid/zero :objects-data frame-id] frame-data) (assoc-in [uuid/zero :objects-data frame-id] frame-data)
@ -106,7 +106,7 @@
:id (:id shape) :id (:id shape)
:pt %)))] :pt %)))]
(cond-> page-data (cond-> page-data
(not (ctl/layout-child? objects shape)) (not (ctl/layout-descent? objects shape))
(-> (assoc-in [frame-id :objects-data (:id shape)] shape-data) (-> (assoc-in [frame-id :objects-data (:id shape)] shape-data)
(update-in [frame-id :x] (make-insert-tree-data shape-data :x)) (update-in [frame-id :x] (make-insert-tree-data shape-data :x))
(update-in [frame-id :y] (make-insert-tree-data shape-data :y)))))) (update-in [frame-id :y] (make-insert-tree-data shape-data :y))))))