mirror of
https://github.com/penpot/penpot.git
synced 2025-02-15 11:38:24 -05:00
🐛 Avoid setting touched flags in imported components
This commit is contained in:
parent
1b8e4dfdfa
commit
2b7c967920
1 changed files with 43 additions and 36 deletions
|
@ -88,6 +88,7 @@
|
||||||
(let [parent-id (-> file :parent-stack peek)
|
(let [parent-id (-> file :parent-stack peek)
|
||||||
change {:type :add-obj
|
change {:type :add-obj
|
||||||
:id (:id obj)
|
:id (:id obj)
|
||||||
|
:ignore-touched true
|
||||||
:obj obj
|
:obj obj
|
||||||
:parent-id parent-id}
|
:parent-id parent-id}
|
||||||
|
|
||||||
|
@ -270,6 +271,7 @@
|
||||||
(commit-change
|
(commit-change
|
||||||
file
|
file
|
||||||
{:type :del-obj
|
{:type :del-obj
|
||||||
|
:ignore-touched true
|
||||||
:id group-id}
|
:id group-id}
|
||||||
{:add-container? true})
|
{:add-container? true})
|
||||||
|
|
||||||
|
@ -280,14 +282,14 @@
|
||||||
{:type :mod-obj
|
{:type :mod-obj
|
||||||
:id group-id
|
:id group-id
|
||||||
:operations
|
:operations
|
||||||
[{:type :set :attr :x :val (-> mask :selrect :x)}
|
[{:type :set :attr :x :val (-> mask :selrect :x) :ignore-touched true}
|
||||||
{:type :set :attr :y :val (-> mask :selrect :y)}
|
{:type :set :attr :y :val (-> mask :selrect :y) :ignore-touched true}
|
||||||
{:type :set :attr :width :val (-> mask :selrect :width)}
|
{:type :set :attr :width :val (-> mask :selrect :width) :ignore-touched true}
|
||||||
{:type :set :attr :height :val (-> mask :selrect :height)}
|
{:type :set :attr :height :val (-> mask :selrect :height) :ignore-touched true}
|
||||||
{:type :set :attr :flip-x :val (-> mask :flip-x)}
|
{:type :set :attr :flip-x :val (-> mask :flip-x) :ignore-touched true}
|
||||||
{:type :set :attr :flip-y :val (-> mask :flip-y)}
|
{:type :set :attr :flip-y :val (-> mask :flip-y) :ignore-touched true}
|
||||||
{:type :set :attr :selrect :val (-> mask :selrect)}
|
{:type :set :attr :selrect :val (-> mask :selrect) :ignore-touched true}
|
||||||
{:type :set :attr :points :val (-> mask :points)}]}
|
{:type :set :attr :points :val (-> mask :points) :ignore-touched true}]}
|
||||||
{:add-container? true}))
|
{:add-container? true}))
|
||||||
|
|
||||||
:else
|
:else
|
||||||
|
@ -297,12 +299,12 @@
|
||||||
{:type :mod-obj
|
{:type :mod-obj
|
||||||
:id group-id
|
:id group-id
|
||||||
:operations
|
:operations
|
||||||
[{:type :set :attr :selrect :val (:selrect group')}
|
[{:type :set :attr :selrect :val (:selrect group') :ignore-touched true}
|
||||||
{:type :set :attr :points :val (:points group')}
|
{:type :set :attr :points :val (:points group') :ignore-touched true}
|
||||||
{:type :set :attr :x :val (-> group' :selrect :x)}
|
{:type :set :attr :x :val (-> group' :selrect :x) :ignore-touched true}
|
||||||
{:type :set :attr :y :val (-> group' :selrect :y)}
|
{:type :set :attr :y :val (-> group' :selrect :y) :ignore-touched true}
|
||||||
{:type :set :attr :width :val (-> group' :selrect :width)}
|
{:type :set :attr :width :val (-> group' :selrect :width) :ignore-touched true}
|
||||||
{:type :set :attr :height :val (-> group' :selrect :height)}]}
|
{:type :set :attr :height :val (-> group' :selrect :height) :ignore-touched true}]}
|
||||||
|
|
||||||
{:add-container? true})))]
|
{:add-container? true})))]
|
||||||
|
|
||||||
|
@ -337,6 +339,7 @@
|
||||||
(commit-change
|
(commit-change
|
||||||
file
|
file
|
||||||
{:type :del-obj
|
{:type :del-obj
|
||||||
|
:ignore-touched true
|
||||||
:id bool-id}
|
:id bool-id}
|
||||||
{:add-container? true})
|
{:add-container? true})
|
||||||
|
|
||||||
|
@ -348,12 +351,12 @@
|
||||||
{:type :mod-obj
|
{:type :mod-obj
|
||||||
:id bool-id
|
:id bool-id
|
||||||
:operations
|
:operations
|
||||||
[{:type :set :attr :selrect :val (:selrect bool')}
|
[{:type :set :attr :selrect :val (:selrect bool') :ignore-touched true}
|
||||||
{:type :set :attr :points :val (:points bool')}
|
{:type :set :attr :points :val (:points bool') :ignore-touched true}
|
||||||
{:type :set :attr :x :val (-> bool' :selrect :x)}
|
{:type :set :attr :x :val (-> bool' :selrect :x) :ignore-touched true}
|
||||||
{:type :set :attr :y :val (-> bool' :selrect :y)}
|
{:type :set :attr :y :val (-> bool' :selrect :y) :ignore-touched true}
|
||||||
{:type :set :attr :width :val (-> bool' :selrect :width)}
|
{:type :set :attr :width :val (-> bool' :selrect :width) :ignore-touched true}
|
||||||
{:type :set :attr :height :val (-> bool' :selrect :height)}]}
|
{:type :set :attr :height :val (-> bool' :selrect :height) :ignore-touched true}]}
|
||||||
|
|
||||||
{:add-container? true})))]
|
{:add-container? true})))]
|
||||||
|
|
||||||
|
@ -490,7 +493,7 @@
|
||||||
:id from-id
|
:id from-id
|
||||||
|
|
||||||
:operations
|
:operations
|
||||||
[{:type :set :attr :interactions :val interactions}]})))))
|
[{:type :set :attr :interactions :val interactions :ignore-touched true}]})))))
|
||||||
|
|
||||||
(defn generate-changes
|
(defn generate-changes
|
||||||
[file]
|
[file]
|
||||||
|
@ -610,14 +613,14 @@
|
||||||
{:type :mod-obj
|
{:type :mod-obj
|
||||||
:id component-id
|
:id component-id
|
||||||
:operations
|
:operations
|
||||||
[{:type :set :attr :x :val (-> mask :selrect :x)}
|
[{:type :set :attr :x :val (-> mask :selrect :x) :ignore-touched true}
|
||||||
{:type :set :attr :y :val (-> mask :selrect :y)}
|
{:type :set :attr :y :val (-> mask :selrect :y) :ignore-touched true}
|
||||||
{:type :set :attr :width :val (-> mask :selrect :width)}
|
{:type :set :attr :width :val (-> mask :selrect :width) :ignore-touched true}
|
||||||
{:type :set :attr :height :val (-> mask :selrect :height)}
|
{:type :set :attr :height :val (-> mask :selrect :height) :ignore-touched true}
|
||||||
{:type :set :attr :flip-x :val (-> mask :flip-x)}
|
{:type :set :attr :flip-x :val (-> mask :flip-x) :ignore-touched true}
|
||||||
{:type :set :attr :flip-y :val (-> mask :flip-y)}
|
{:type :set :attr :flip-y :val (-> mask :flip-y) :ignore-touched true}
|
||||||
{:type :set :attr :selrect :val (-> mask :selrect)}
|
{:type :set :attr :selrect :val (-> mask :selrect) :ignore-touched true}
|
||||||
{:type :set :attr :points :val (-> mask :points)}]}
|
{:type :set :attr :points :val (-> mask :points) :ignore-touched true}]}
|
||||||
|
|
||||||
{:add-container? true}))
|
{:add-container? true}))
|
||||||
|
|
||||||
|
@ -628,12 +631,12 @@
|
||||||
{:type :mod-obj
|
{:type :mod-obj
|
||||||
:id component-id
|
:id component-id
|
||||||
:operations
|
:operations
|
||||||
[{:type :set :attr :selrect :val (:selrect component')}
|
[{:type :set :attr :selrect :val (:selrect component') :ignore-touched true}
|
||||||
{:type :set :attr :points :val (:points component')}
|
{:type :set :attr :points :val (:points component') :ignore-touched true}
|
||||||
{:type :set :attr :x :val (-> component' :selrect :x)}
|
{:type :set :attr :x :val (-> component' :selrect :x) :ignore-touched true}
|
||||||
{:type :set :attr :y :val (-> component' :selrect :y)}
|
{:type :set :attr :y :val (-> component' :selrect :y) :ignore-touched true}
|
||||||
{:type :set :attr :width :val (-> component' :selrect :width)}
|
{:type :set :attr :width :val (-> component' :selrect :width) :ignore-touched true}
|
||||||
{:type :set :attr :height :val (-> component' :selrect :height)}]}
|
{:type :set :attr :height :val (-> component' :selrect :height) :ignore-touched true}]}
|
||||||
|
|
||||||
{:add-container? true})))]
|
{:add-container? true})))]
|
||||||
|
|
||||||
|
@ -665,6 +668,7 @@
|
||||||
:page-id (:id page)
|
:page-id (:id page)
|
||||||
:parent-id (:parent-id %2)
|
:parent-id (:parent-id %2)
|
||||||
:frame-id (:frame-id %2)
|
:frame-id (:frame-id %2)
|
||||||
|
:ignore-touched true
|
||||||
:obj %2})
|
:obj %2})
|
||||||
$
|
$
|
||||||
shapes)
|
shapes)
|
||||||
|
@ -672,6 +676,7 @@
|
||||||
:id component-id})
|
:id component-id})
|
||||||
(reduce #(commit-change %1 {:type :del-obj
|
(reduce #(commit-change %1 {:type :del-obj
|
||||||
:page-id page-id
|
:page-id page-id
|
||||||
|
:ignore-touched true
|
||||||
:id (:id %2)})
|
:id (:id %2)})
|
||||||
$
|
$
|
||||||
shapes)
|
shapes)
|
||||||
|
@ -704,6 +709,7 @@
|
||||||
:page-id (:id page)
|
:page-id (:id page)
|
||||||
:parent-id (:parent-id %2)
|
:parent-id (:parent-id %2)
|
||||||
:frame-id (:frame-id %2)
|
:frame-id (:frame-id %2)
|
||||||
|
:ignore-touched true
|
||||||
:obj %2})
|
:obj %2})
|
||||||
$
|
$
|
||||||
shapes)
|
shapes)
|
||||||
|
@ -718,6 +724,7 @@
|
||||||
file
|
file
|
||||||
{:type :del-obj
|
{:type :del-obj
|
||||||
:page-id page-id
|
:page-id page-id
|
||||||
|
:ignore-touched true
|
||||||
:id id})))
|
:id id})))
|
||||||
|
|
||||||
(defn update-object
|
(defn update-object
|
||||||
|
@ -731,7 +738,7 @@
|
||||||
new-val (get new-obj attr)]
|
new-val (get new-obj attr)]
|
||||||
(if (= old-val new-val)
|
(if (= old-val new-val)
|
||||||
changes
|
changes
|
||||||
(conj changes {:type :set :attr attr :val new-val}))))]
|
(conj changes {:type :set :attr attr :val new-val :ignore-touched true}))))]
|
||||||
(-> file
|
(-> file
|
||||||
(commit-change
|
(commit-change
|
||||||
{:type :mod-obj
|
{:type :mod-obj
|
||||||
|
|
Loading…
Add table
Reference in a new issue