mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 16:00:19 -05:00
🐛 Fix add fill to artboard modify children
This commit is contained in:
parent
327331475e
commit
df930cb879
3 changed files with 28 additions and 8 deletions
|
@ -44,6 +44,7 @@
|
||||||
### :bug: Bugs fixed
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
- Fix duplicate multi selected elements [Taiga #3155](https://tree.taiga.io/project/penpot/issue/3155)
|
- Fix duplicate multi selected elements [Taiga #3155](https://tree.taiga.io/project/penpot/issue/3155)
|
||||||
|
- Fix add fills to artboard modify children [Taiga #3151](https://tree.taiga.io/project/penpot/issue/3151)
|
||||||
- Avoid numeric inputs to allow big numbers [Taiga #2858](https://tree.taiga.io/project/penpot/issue/2858)
|
- Avoid numeric inputs to allow big numbers [Taiga #2858](https://tree.taiga.io/project/penpot/issue/2858)
|
||||||
- Fix component contex menu size [Taiga #2480](https://tree.taiga.io/project/penpot/issue/2480)
|
- Fix component contex menu size [Taiga #2480](https://tree.taiga.io/project/penpot/issue/2480)
|
||||||
- Add shadow to artboard make it lose the fill [Taiga #3139](https://tree.taiga.io/project/penpot/issue/3139)
|
- Add shadow to artboard make it lose the fill [Taiga #3139](https://tree.taiga.io/project/penpot/issue/3139)
|
||||||
|
|
|
@ -8,12 +8,14 @@
|
||||||
(:require
|
(:require
|
||||||
[app.common.colors :as clr]
|
[app.common.colors :as clr]
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
|
[app.common.pages.helpers :as cph]
|
||||||
[app.main.data.modal :as md]
|
[app.main.data.modal :as md]
|
||||||
[app.main.data.workspace.changes :as dch]
|
[app.main.data.workspace.changes :as dch]
|
||||||
[app.main.data.workspace.layout :as layout]
|
[app.main.data.workspace.layout :as layout]
|
||||||
[app.main.data.workspace.state-helpers :as wsh]
|
[app.main.data.workspace.state-helpers :as wsh]
|
||||||
[app.main.data.workspace.texts :as dwt]
|
[app.main.data.workspace.texts :as dwt]
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
|
[app.util.color :as uc]
|
||||||
[beicon.core :as rx]
|
[beicon.core :as rx]
|
||||||
[potok.core :as ptk]))
|
[potok.core :as ptk]))
|
||||||
|
|
||||||
|
@ -179,12 +181,12 @@
|
||||||
(ptk/reify ::change-fill
|
(ptk/reify ::change-fill
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state _]
|
(watch [_ state _]
|
||||||
(let [change (fn [shape attrs]
|
(let [change-fn (fn [shape attrs]
|
||||||
(-> shape
|
(-> shape
|
||||||
(cond-> (not (contains? shape :fills))
|
(cond-> (not (contains? shape :fills))
|
||||||
(assoc :fills []))
|
(assoc :fills []))
|
||||||
(assoc-in [:fills position] (into {} attrs))))]
|
(assoc-in [:fills position] (into {} attrs))))]
|
||||||
(transform-fill state ids color change)))))
|
(transform-fill state ids color change-fn)))))
|
||||||
|
|
||||||
(defn change-fill-and-clear
|
(defn change-fill-and-clear
|
||||||
[ids color]
|
[ids color]
|
||||||
|
@ -390,3 +392,24 @@
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(-> state
|
(-> state
|
||||||
(assoc-in [:workspace-global :editing-stop] spot)))))
|
(assoc-in [:workspace-global :editing-stop] spot)))))
|
||||||
|
|
||||||
|
(defn apply-color-from-palette
|
||||||
|
[color is-alt?]
|
||||||
|
(ptk/reify ::apply-color-from-palette
|
||||||
|
ptk/WatchEvent
|
||||||
|
(watch [_ state _]
|
||||||
|
(let [objects (wsh/lookup-page-objects state)
|
||||||
|
selected (->> (wsh/lookup-selected state)
|
||||||
|
(cph/clean-loops objects))
|
||||||
|
selected-obj (keep (d/getf objects) selected)
|
||||||
|
select-shapes-for-color (fn [shape objects]
|
||||||
|
(let [shapes (case (:type shape)
|
||||||
|
:group (cph/get-children objects (:id shape))
|
||||||
|
[shape])]
|
||||||
|
(->> shapes
|
||||||
|
(remove cph/group-shape?)
|
||||||
|
(map :id))))
|
||||||
|
ids (mapcat #(select-shapes-for-color % objects) selected-obj)]
|
||||||
|
(if is-alt?
|
||||||
|
(rx/of (change-stroke ids (merge uc/empty-color color) 0))
|
||||||
|
(rx/of (change-fill ids (merge uc/empty-color color) 0)))))))
|
|
@ -13,7 +13,6 @@
|
||||||
[app.main.ui.components.dropdown :refer [dropdown]]
|
[app.main.ui.components.dropdown :refer [dropdown]]
|
||||||
[app.main.ui.hooks.resize :refer [use-resize-hook]]
|
[app.main.ui.hooks.resize :refer [use-resize-hook]]
|
||||||
[app.main.ui.icons :as i]
|
[app.main.ui.icons :as i]
|
||||||
[app.util.color :as uc]
|
|
||||||
[app.util.dom :as dom]
|
[app.util.dom :as dom]
|
||||||
[app.util.i18n :refer [tr]]
|
[app.util.i18n :refer [tr]]
|
||||||
[app.util.keyboard :as kbd]
|
[app.util.keyboard :as kbd]
|
||||||
|
@ -40,12 +39,9 @@
|
||||||
;; --- Components
|
;; --- Components
|
||||||
(mf/defc palette-item
|
(mf/defc palette-item
|
||||||
[{:keys [color]}]
|
[{:keys [color]}]
|
||||||
(let [ids-with-children (map :id (mf/deref refs/selected-shapes-with-children))
|
(let [select-color
|
||||||
select-color
|
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(if (kbd/alt? event)
|
(st/emit! (mdc/apply-color-from-palette color (kbd/alt? event))))]
|
||||||
(st/emit! (mdc/change-stroke ids-with-children (merge uc/empty-color color) 0))
|
|
||||||
(st/emit! (mdc/change-fill ids-with-children (merge uc/empty-color color) 0))))]
|
|
||||||
|
|
||||||
[:div.color-cell {:on-click select-color}
|
[:div.color-cell {:on-click select-color}
|
||||||
[:& cb/color-bullet {:color color}]
|
[:& cb/color-bullet {:color color}]
|
||||||
|
|
Loading…
Reference in a new issue