mirror of
https://github.com/penpot/penpot.git
synced 2025-02-23 07:16:07 -05:00
🐛 Ignore remote changes in size
This commit is contained in:
parent
107d607d37
commit
2dea2d9d27
4 changed files with 19 additions and 6 deletions
|
@ -669,3 +669,13 @@
|
||||||
:id id})
|
:id id})
|
||||||
(update :undo-changes d/preconj {:type :del-component
|
(update :undo-changes d/preconj {:type :del-component
|
||||||
:id id})))
|
:id id})))
|
||||||
|
|
||||||
|
(defn ignore-remote
|
||||||
|
[changes]
|
||||||
|
(letfn [(add-ignore-remote
|
||||||
|
[change-list]
|
||||||
|
(->> change-list
|
||||||
|
(mapv #(assoc % :ignore-remote? true))))]
|
||||||
|
(-> changes
|
||||||
|
(update :redo-changes add-ignore-remote)
|
||||||
|
(update :undo-changes add-ignore-remote))))
|
||||||
|
|
|
@ -55,8 +55,8 @@
|
||||||
|
|
||||||
(defn update-shapes
|
(defn update-shapes
|
||||||
([ids update-fn] (update-shapes ids update-fn nil))
|
([ids update-fn] (update-shapes ids update-fn nil))
|
||||||
([ids update-fn {:keys [reg-objects? save-undo? stack-undo? attrs ignore-tree page-id]
|
([ids update-fn {:keys [reg-objects? save-undo? stack-undo? attrs ignore-tree page-id ignore-remote?]
|
||||||
:or {reg-objects? false save-undo? true stack-undo? false}}]
|
:or {reg-objects? false save-undo? true stack-undo? false ignore-remote? false}}]
|
||||||
(us/assert ::coll-of-uuid ids)
|
(us/assert ::coll-of-uuid ids)
|
||||||
(us/assert fn? update-fn)
|
(us/assert fn? update-fn)
|
||||||
|
|
||||||
|
@ -85,7 +85,8 @@
|
||||||
changes (add-group-id changes state)]
|
changes (add-group-id changes state)]
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(if (seq (:redo-changes changes))
|
(if (seq (:redo-changes changes))
|
||||||
(let [changes (cond-> changes reg-objects? (pcb/resize-parents ids))]
|
(let [changes (cond-> changes reg-objects? (pcb/resize-parents ids))
|
||||||
|
changes (cond-> changes ignore-remote? (pcb/ignore-remote))]
|
||||||
(rx/of (commit-changes changes)))
|
(rx/of (commit-changes changes)))
|
||||||
(rx/empty))
|
(rx/empty))
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,9 @@
|
||||||
(dch/update-indices page-id changes))
|
(dch/update-indices page-id changes))
|
||||||
|
|
||||||
;; We update `position-data` from the incoming message
|
;; We update `position-data` from the incoming message
|
||||||
changes (->> changes (mapv update-position-data))
|
changes (->> changes
|
||||||
|
(mapv update-position-data)
|
||||||
|
(d/removev :ignore-remote?))
|
||||||
changes-by-pages (group-by :page-id changes)]
|
changes-by-pages (group-by :page-id changes)]
|
||||||
|
|
||||||
(rx/merge
|
(rx/merge
|
||||||
|
|
|
@ -414,7 +414,7 @@
|
||||||
|
|
||||||
(let [ids (->> (keys props) (filter changed-text?))]
|
(let [ids (->> (keys props) (filter changed-text?))]
|
||||||
(rx/of (dwu/start-undo-transaction undo-id)
|
(rx/of (dwu/start-undo-transaction undo-id)
|
||||||
(dch/update-shapes ids update-fn {:reg-objects? true :stack-undo? true})
|
(dch/update-shapes ids update-fn {:reg-objects? true :stack-undo? true :ignore-remote? true})
|
||||||
(ptk/data-event :layout/update ids)
|
(ptk/data-event :layout/update ids)
|
||||||
(dwu/commit-undo-transaction undo-id))))))))
|
(dwu/commit-undo-transaction undo-id))))))))
|
||||||
|
|
||||||
|
@ -558,7 +558,7 @@
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
(-> shape
|
(-> shape
|
||||||
(assoc :position-data (get position-data (:id shape)))))
|
(assoc :position-data (get position-data (:id shape)))))
|
||||||
{:stack-undo? true :reg-objects? false}))
|
{:stack-undo? true :reg-objects? false :ignore-remote? true}))
|
||||||
(rx/of (fn [state]
|
(rx/of (fn [state]
|
||||||
(dissoc state ::update-position-data-debounce ::update-position-data))))))))
|
(dissoc state ::update-position-data-debounce ::update-position-data))))))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue