mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 07:41:43 -05:00
⚡ Improvements after review
This commit is contained in:
parent
565046aaa6
commit
7564f27f95
9 changed files with 12 additions and 12 deletions
|
@ -157,7 +157,7 @@
|
|||
"Return a map without the keys provided
|
||||
in the `keys` parameter."
|
||||
[data keys]
|
||||
(when (and (some? data) (map? data))
|
||||
(when (map? data)
|
||||
(persistent!
|
||||
(reduce #(dissoc! %1 %2) (transient data) keys))))
|
||||
|
||||
|
|
|
@ -345,8 +345,7 @@
|
|||
;; or not.
|
||||
|
||||
(defn empty-modifiers? [modifiers]
|
||||
(or (nil? modifiers)
|
||||
(empty? (d/without-keys modifiers [:ignore-geometry?]))))
|
||||
(empty? (dissoc modifiers :ignore-geometry?)))
|
||||
|
||||
(defn resize-modifiers
|
||||
[shape attr value]
|
||||
|
|
|
@ -502,6 +502,7 @@
|
|||
(defn children-seq
|
||||
"Creates a sequence of shapes through the objects tree"
|
||||
[shape objects]
|
||||
(let [getter (partial get objects)]
|
||||
(tree-seq #(d/not-empty? (get shape :shapes))
|
||||
#(->> (get % :shapes) (map (partial get objects)))
|
||||
shape))
|
||||
#(->> (get % :shapes) (map getter))
|
||||
shape)))
|
||||
|
|
|
@ -506,7 +506,7 @@
|
|||
(let [typographies (get-assets library-id :typographies state)
|
||||
update-node (fn [node]
|
||||
(if-let [typography (get typographies (:typography-ref-id node))]
|
||||
(merge node (d/without-keys typography [:name :id]))
|
||||
(merge node (dissoc typography :name :id))
|
||||
(dissoc node :typography-ref-id
|
||||
:typography-ref-file)))]
|
||||
(generate-sync-text-shape shape container update-node)))
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
[{:keys [grids]}]
|
||||
[:> "penpot:grids" #js {}
|
||||
(for [{:keys [type display params]} grids]
|
||||
(let [props (->> (d/without-keys params [:color])
|
||||
(let [props (->> (dissoc params :color)
|
||||
(prefix-keys)
|
||||
(clj->js))]
|
||||
[:> "penpot:grid"
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
(let [{:keys [x y width height fill-color] :as shape} (obj/get props "shape")]
|
||||
(if (some? (:thumbnail shape))
|
||||
[:& thumbnail {:shape shape}]
|
||||
[:rect {:x x :y y :width width :height height :style {:fill (or fill-color "white")}}])))
|
||||
[:rect {:x x :y y :width width :height height :style {:fill (or fill-color "var(--color-white)")}}])))
|
||||
|
||||
(defn custom-deferred
|
||||
[component]
|
||||
|
|
|
@ -1172,7 +1172,7 @@
|
|||
attrs (merge
|
||||
{:typography-ref-file file-id
|
||||
:typography-ref-id (:id typography)}
|
||||
(d/without-keys typography [:id :name]))]
|
||||
(dissoc typography :id :name))]
|
||||
(run! #(st/emit! (dwt/update-text-attrs {:id % :editor (get-in local [:editors %]) :attrs attrs}))
|
||||
ids)))
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
update-color
|
||||
(fn [index]
|
||||
(fn [color opacity]
|
||||
(let [color (d/without-keys color [:id :file-id :gradient])]
|
||||
(let [color (dissoc color :id :file-id :gradient)]
|
||||
(st/emit! (dch/update-shapes
|
||||
ids
|
||||
#(-> %
|
||||
|
|
|
@ -483,7 +483,7 @@
|
|||
color {:color (:color attrs)
|
||||
:opacity (-> attrs :opacity d/parse-double)}
|
||||
|
||||
params (-> (d/without-keys attrs [:color :opacity :display :type])
|
||||
params (-> (dissoc attrs :color :opacity :display :type)
|
||||
(d/update-when :size d/parse-double)
|
||||
(d/update-when :item-length d/parse-double)
|
||||
(d/update-when :gutter d/parse-double)
|
||||
|
|
Loading…
Add table
Reference in a new issue