Merge pull request #3599 from penpot/niwinz-develop-experiments-3

🐛 Replace `:use-for-thumbnail?` with `:use-for-thumbnail`
This commit is contained in:
Alejandro 2023-09-14 06:39:06 +02:00 committed by GitHub
commit a4754a2106
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 14 deletions

View file

@ -462,7 +462,7 @@
fdata (:workspace-data state)
components-v2 (dm/get-in fdata [:options :components-v2])
objects (->> (:objects page)
(d/mapm (fn [_ val] (dissoc val :use-for-thumbnail?))))
(d/mapm (fn [_ val] (dissoc val :use-for-thumbnail))))
main-instances-ids (set (keep #(when (ctk/main-instance? (val %)) (key %)) objects))
ids-to-remove (set (apply concat (map #(cph/get-children-ids objects %) main-instances-ids)))

View file

@ -450,8 +450,8 @@
:frame-id frame-id)
(dissoc :shapes
:main-instance?
:use-for-thumbnail?)
:main-instance
:use-for-thumbnail)
(cond->
(or frame? group? bool?)

View file

@ -504,7 +504,7 @@
pages (-> state :workspace-data :pages-index vals)]
(rx/concat
;; First: clear the `:use-for-thumbnail?` flag from all not
;; First: clear the `:use-for-thumbnail` flag from all not
;; selected frames.
(rx/from
(->> pages
@ -512,13 +512,13 @@
(fn [{:keys [objects id] :as page}]
(->> (ctst/get-frames objects)
(sequence
(comp (filter :use-for-thumbnail?)
(comp (filter :use-for-thumbnail)
(map :id)
(remove selected)
(map (partial vector id)))))))
(d/group-by first second)
(map (fn [[page-id frame-ids]]
(dch/update-shapes frame-ids #(dissoc % :use-for-thumbnail?) {:page-id page-id})))))
(dch/update-shapes frame-ids #(dissoc % :use-for-thumbnail) {:page-id page-id})))))
;; And finally: toggle the flag value on all the selected shapes
(rx/of (dch/update-shapes selected #(update % :use-for-thumbnail? not))))))))
(rx/of (dch/update-shapes selected #(update % :use-for-thumbnail not))))))))

View file

@ -237,7 +237,7 @@
do-toggle-thumbnail #(st/emit! (dw/toggle-file-thumbnail-selected))]
(when (and single? has-frame?)
[:*
(if (every? :use-for-thumbnail? shapes)
(if (every? :use-for-thumbnail shapes)
[:& menu-entry {:title (tr "workspace.shape.menu.thumbnail-remove")
:on-click do-toggle-thumbnail}]
[:& menu-entry {:title (tr "workspace.shape.menu.thumbnail-set")

View file

@ -170,7 +170,7 @@
(on-frame-leave (:id frame))))
main-instance? (ctk/main-instance? frame)
text-pos-x (if (or (:use-for-thumbnail? frame) grid-edition? main-instance?) 15 0)]
text-pos-x (if (or (:use-for-thumbnail frame) grid-edition? main-instance?) 15 0)]
(when (not (:hidden frame))
[:g.frame-title {:id (dm/str "frame-title-" (:id frame))
@ -178,7 +178,7 @@
:transform (vwu/title-transform frame zoom grid-edition?)
:pointer-events (when (:blocked frame) "none")}
(cond
(or (:use-for-thumbnail? frame) grid-edition? main-instance?)
(or (:use-for-thumbnail frame) grid-edition? main-instance?)
[:svg {:x 0
:y -9
:width 12
@ -187,7 +187,7 @@
:style {:fill color}
:visibility (if show-artboard-names? "visible" "hidden")}
(cond
(:use-for-thumbnail? frame)
(:use-for-thumbnail frame)
[:use {:href "#icon-set-thumbnail"}]
grid-edition?