Hide bounding box while editing visual effects

This commit is contained in:
Alejandro Alonso 2025-07-15 12:00:34 +02:00
parent f3abd0f190
commit abbfd44534
6 changed files with 76 additions and 15 deletions

View File

@ -19,6 +19,7 @@
- Provide CSS `mix-blend-mode` property in code editor when present on shape [Taiga #11282](https://tree.taiga.io/project/penpot/issue/11282) - Provide CSS `mix-blend-mode` property in code editor when present on shape [Taiga #11282](https://tree.taiga.io/project/penpot/issue/11282)
- Add the option to import tokens in a .zip file. [Taiga #11378](https://tree.taiga.io/project/penpot/us/11378) - Add the option to import tokens in a .zip file. [Taiga #11378](https://tree.taiga.io/project/penpot/us/11378)
- New typography token type - font size token [Taiga #10938](https://tree.taiga.io/project/penpot/us/10938) - New typography token type - font size token [Taiga #10938](https://tree.taiga.io/project/penpot/us/10938)
- Hide bounding box while editing visual effects [Taiga #11576](https://tree.taiga.io/project/penpot/issue/11576)
### :bug: Bugs fixed ### :bug: Bugs fixed
- Copying font size does not copy the unit [Taiga #11143](https://tree.taiga.io/project/penpot/issue/11143) - Copying font size does not copy the unit [Taiga #11143](https://tree.taiga.io/project/penpot/issue/11143)

View File

@ -8,6 +8,7 @@
(:require-macros [app.main.style :as stl]) (:require-macros [app.main.style :as stl])
(:require (:require
[app.common.uuid :as uuid] [app.common.uuid :as uuid]
[app.main.data.workspace :as udw]
[app.main.data.workspace.shapes :as dwsh] [app.main.data.workspace.shapes :as dwsh]
[app.main.store :as st] [app.main.store :as st]
[app.main.ui.components.numeric-input :refer [numeric-input*]] [app.main.ui.components.numeric-input :refer [numeric-input*]]
@ -49,20 +50,23 @@
handle-add handle-add
(mf/use-fn (mf/use-fn
(mf/deps change!) (mf/deps change! ids)
(fn [] (fn []
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(change! #(assoc % :blur (create-blur))))) (change! #(assoc % :blur (create-blur)))))
handle-delete handle-delete
(mf/use-fn (mf/use-fn
(mf/deps change!) (mf/deps change! ids)
(fn [] (fn []
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(change! #(dissoc % :blur)))) (change! #(dissoc % :blur))))
handle-change handle-change
(mf/use-fn (mf/use-fn
(mf/deps change!) (mf/deps change! ids)
(fn [value] (fn [value]
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(change! #(cond-> % (change! #(cond-> %
(not (contains? % :blur)) (not (contains? % :blur))
(assoc :blur (create-blur)) (assoc :blur (create-blur))
@ -72,8 +76,9 @@
handle-toggle-visibility handle-toggle-visibility
(mf/use-fn (mf/use-fn
(mf/deps change!) (mf/deps change! ids)
(fn [] (fn []
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(change! #(update-in % [:blur :hidden] not))))] (change! #(update-in % [:blur :hidden] not))))]
[:div {:class (stl/css :element-set)} [:div {:class (stl/css :element-set)}

View File

@ -11,6 +11,7 @@
[app.common.types.fill :as types.fill] [app.common.types.fill :as types.fill]
[app.common.types.shape.attrs :refer [default-color]] [app.common.types.shape.attrs :refer [default-color]]
[app.config :as cfg] [app.config :as cfg]
[app.main.data.workspace :as udw]
[app.main.data.workspace.colors :as dc] [app.main.data.workspace.colors :as dc]
[app.main.store :as st] [app.main.store :as st]
[app.main.ui.components.title-bar :refer [title-bar]] [app.main.ui.components.title-bar :refer [title-bar]]
@ -114,6 +115,7 @@
(mf/deps ids multiple? empty-fills?) (mf/deps ids multiple? empty-fills?)
(fn [_] (fn [_]
(when can-add-fills? (when can-add-fills?
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/add-fill ids {:color default-color (st/emit! (dc/add-fill ids {:color default-color
:opacity 1})) :opacity 1}))
(when (or multiple? empty-fills?) (when (or multiple? empty-fills?)
@ -124,6 +126,7 @@
(mf/deps ids) (mf/deps ids)
(fn [color index] (fn [color index]
(let [color (select-keys color ctc/color-attrs)] (let [color (select-keys color ctc/color-attrs)]
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/change-fill ids color index))))) (st/emit! (dc/change-fill ids color index)))))
on-reorder on-reorder

View File

@ -90,6 +90,7 @@
(wasm.api/use-shape (:id shape)) (wasm.api/use-shape (:id shape))
(wasm.api/set-shape-blend-mode value))) (wasm.api/set-shape-blend-mode value)))
(st/emit! (dw/trigger-bounding-box-cloaking ids))
(st/emit! (dw/set-preview-blend-mode ids value)))) (st/emit! (dw/set-preview-blend-mode ids value))))
handle-blend-mode-leave handle-blend-mode-leave
@ -101,33 +102,38 @@
handle-opacity-change handle-opacity-change
(mf/use-fn (mf/use-fn
(mf/deps on-change) (mf/deps on-change ids)
(fn [value] (fn [value]
(st/emit! (dw/trigger-bounding-box-cloaking ids))
(let [value (/ value 100)] (let [value (/ value 100)]
(on-change :opacity value)))) (on-change :opacity value))))
handle-set-hidden handle-set-hidden
(mf/use-fn (mf/use-fn
(mf/deps on-change) (mf/deps on-change ids)
(fn [_] (fn [_]
(st/emit! (dw/trigger-bounding-box-cloaking ids))
(on-change :hidden true))) (on-change :hidden true)))
handle-set-visible handle-set-visible
(mf/use-fn (mf/use-fn
(mf/deps on-change) (mf/deps on-change ids)
(fn [_] (fn [_]
(st/emit! (dw/trigger-bounding-box-cloaking ids))
(on-change :hidden false))) (on-change :hidden false)))
handle-set-blocked handle-set-blocked
(mf/use-fn (mf/use-fn
(mf/deps on-change) (mf/deps on-change ids)
(fn [_] (fn [_]
(st/emit! (dw/trigger-bounding-box-cloaking ids))
(on-change :blocked true))) (on-change :blocked true)))
handle-set-unblocked handle-set-unblocked
(mf/use-fn (mf/use-fn
(mf/deps on-change) (mf/deps on-change ids)
(fn [_] (fn [_]
(st/emit! (dw/trigger-bounding-box-cloaking ids))
(on-change :blocked false))) (on-change :blocked false)))
options options

View File

@ -12,6 +12,7 @@
[app.common.data.macros :as dm] [app.common.data.macros :as dm]
[app.common.types.shape.shadow :as ctss] [app.common.types.shape.shadow :as ctss]
[app.common.uuid :as uuid] [app.common.uuid :as uuid]
[app.main.data.workspace :as dw]
[app.main.data.workspace.colors :as dc] [app.main.data.workspace.colors :as dc]
[app.main.data.workspace.shapes :as dwsh] [app.main.data.workspace.shapes :as dwsh]
[app.main.data.workspace.undo :as dwu] [app.main.data.workspace.undo :as dwu]
@ -80,31 +81,56 @@
(mf/use-fn (mf/deps index) #(on-remove index)) (mf/use-fn (mf/deps index) #(on-remove index))
on-update-offset-x on-update-offset-x
(mf/use-fn (mf/deps index) #(on-update index :offset-x %)) (mf/use-fn
(mf/deps index)
(fn [value]
(st/emit! (dw/trigger-bounding-box-cloaking [shadow-id]))
(on-update index :offset-x value)))
on-update-offset-y on-update-offset-y
(mf/use-fn (mf/deps index) #(on-update index :offset-y %)) (mf/use-fn
(mf/deps index)
(fn [value]
(st/emit! (dw/trigger-bounding-box-cloaking [shadow-id]))
(on-update index :offset-y value)))
on-update-spread on-update-spread
(mf/use-fn (mf/deps index) #(on-update index :spread %)) (mf/use-fn
(mf/deps index)
(fn [value]
(st/emit! (dw/trigger-bounding-box-cloaking [shadow-id]))
(on-update index :spread value)))
on-update-blur on-update-blur
(mf/use-fn (mf/deps index) #(on-update index :blur %)) (mf/use-fn
(mf/deps index)
(fn [value]
(st/emit! (dw/trigger-bounding-box-cloaking [shadow-id]))
(on-update index :blur value)))
on-update-color on-update-color
(mf/use-fn (mf/use-fn
(mf/deps index on-update) (mf/deps index on-update)
(fn [color] (fn [color]
(st/emit! (dw/trigger-bounding-box-cloaking [shadow-id]))
(on-update index :color color))) (on-update index :color color)))
on-detach-color on-detach-color
(mf/use-fn (mf/deps index) #(on-detach-color index)) (mf/use-fn (mf/deps index) #(on-detach-color index))
on-style-change on-style-change
(mf/use-fn (mf/deps index) #(on-update index :style (keyword %))) (mf/use-fn
(mf/deps index)
(fn [value]
(st/emit! (dw/trigger-bounding-box-cloaking [shadow-id]))
(on-update index :style (keyword value))))
on-toggle-visibility on-toggle-visibility
(mf/use-fn (mf/deps index) #(on-toggle-visibility index)) (mf/use-fn
(mf/deps index)
(fn []
(st/emit! (dw/trigger-bounding-box-cloaking [shadow-id]))
(on-toggle-visibility index)))
on-toggle-open on-toggle-open
(mf/use-fn (mf/use-fn
@ -242,18 +268,21 @@
(mf/use-fn (mf/use-fn
(fn [] (fn []
(let [ids (mf/ref-val ids-ref)] (let [ids (mf/ref-val ids-ref)]
(st/emit! (dw/trigger-bounding-box-cloaking ids))
(st/emit! (dwsh/update-shapes ids #(dissoc % :shadow)))))) (st/emit! (dwsh/update-shapes ids #(dissoc % :shadow))))))
handle-reorder handle-reorder
(mf/use-fn (mf/use-fn
(fn [new-index index] (fn [new-index index]
(let [ids (mf/ref-val ids-ref)] (let [ids (mf/ref-val ids-ref)]
(st/emit! (dw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/reorder-shadows ids index new-index))))) (st/emit! (dc/reorder-shadows ids index new-index)))))
on-add-shadow on-add-shadow
(mf/use-fn (mf/use-fn
(fn [] (fn []
(let [ids (mf/ref-val ids-ref)] (let [ids (mf/ref-val ids-ref)]
(st/emit! (dw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/add-shadow ids (create-shadow)))))) (st/emit! (dc/add-shadow ids (create-shadow))))))
on-detach-color on-detach-color
@ -261,18 +290,22 @@
(fn [index] (fn [index]
(let [ids (mf/ref-val ids-ref) (let [ids (mf/ref-val ids-ref)
f #(update-in % [:shadow index :color] dissoc :id :file-id :ref-id :ref-file)] f #(update-in % [:shadow index :color] dissoc :id :file-id :ref-id :ref-file)]
(st/emit! (dw/trigger-bounding-box-cloaking ids))
(st/emit! (dwsh/update-shapes ids f))))) (st/emit! (dwsh/update-shapes ids f)))))
on-toggle-visibility on-toggle-visibility
(mf/use-fn (mf/use-fn
(fn [index] (fn [index]
(let [ids (mf/ref-val ids-ref)] (let [ids (mf/ref-val ids-ref)]
(st/emit! (dw/trigger-bounding-box-cloaking ids))
(st/emit! (dwsh/update-shapes ids #(update-in % [:shadow index :hidden] not)))))) (st/emit! (dwsh/update-shapes ids #(update-in % [:shadow index :hidden] not))))))
on-remove on-remove
(mf/use-fn (mf/use-fn
(mf/deps ids)
(fn [index] (fn [index]
(let [ids (mf/ref-val ids-ref)] (let [ids (mf/ref-val ids-ref)]
(st/emit! (dw/trigger-bounding-box-cloaking ids))
(st/emit! (dwsh/update-shapes ids #(update % :shadow remove-shadow-by-index index)))))) (st/emit! (dwsh/update-shapes ids #(update % :shadow remove-shadow-by-index index))))))
on-update on-update

View File

@ -10,6 +10,7 @@
[app.common.colors :as clr] [app.common.colors :as clr]
[app.common.data :as d] [app.common.data :as d]
[app.common.data.macros :as dm] [app.common.data.macros :as dm]
[app.main.data.workspace :as udw]
[app.main.data.workspace.colors :as dc] [app.main.data.workspace.colors :as dc]
[app.main.store :as st] [app.main.store :as st]
[app.main.ui.components.title-bar :refer [title-bar]] [app.main.ui.components.title-bar :refer [title-bar]]
@ -56,6 +57,7 @@
(mf/use-fn (mf/use-fn
(mf/deps ids) (mf/deps ids)
(fn [index color] (fn [index color]
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/change-stroke-color ids color index)))) (st/emit! (dc/change-stroke-color ids color index))))
@ -63,18 +65,21 @@
(mf/use-fn (mf/use-fn
(mf/deps ids) (mf/deps ids)
(fn [index] (fn [index]
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/remove-stroke ids index)))) (st/emit! (dc/remove-stroke ids index))))
handle-remove-all handle-remove-all
(mf/use-fn (mf/use-fn
(mf/deps ids) (mf/deps ids)
(fn [_] (fn [_]
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/remove-all-strokes ids)))) (st/emit! (dc/remove-all-strokes ids))))
on-color-detach on-color-detach
(mf/use-fn (mf/use-fn
(mf/deps ids) (mf/deps ids)
(fn [index color] (fn [index color]
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(let [color (-> color (let [color (-> color
(dissoc :ref-id :ref-file))] (dissoc :ref-id :ref-file))]
(st/emit! (dc/change-stroke-color ids color index))))) (st/emit! (dc/change-stroke-color ids color index)))))
@ -84,22 +89,26 @@
(mf/deps ids) (mf/deps ids)
(fn [new-index] (fn [new-index]
(fn [index] (fn [index]
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/reorder-strokes ids index new-index))))) (st/emit! (dc/reorder-strokes ids index new-index)))))
on-stroke-style-change on-stroke-style-change
(mf/use-fn (mf/use-fn
(mf/deps ids) (mf/deps ids)
(fn [index value] (fn [index value]
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/change-stroke-attrs ids {:stroke-style value} index)))) (st/emit! (dc/change-stroke-attrs ids {:stroke-style value} index))))
on-stroke-alignment-change on-stroke-alignment-change
(fn [index value] (fn [index value]
(when-not (str/empty? value) (when-not (str/empty? value)
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/change-stroke-attrs ids {:stroke-alignment value} index)))) (st/emit! (dc/change-stroke-attrs ids {:stroke-alignment value} index))))
on-stroke-width-change on-stroke-width-change
(fn [index value] (fn [index value]
(when-not (str/empty? value) (when-not (str/empty? value)
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/change-stroke-attrs ids {:stroke-width value} index)))) (st/emit! (dc/change-stroke-attrs ids {:stroke-width value} index))))
open-caps-select open-caps-select
@ -128,10 +137,12 @@
on-stroke-cap-start-change on-stroke-cap-start-change
(fn [index value] (fn [index value]
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/change-stroke-attrs ids {:stroke-cap-start value} index))) (st/emit! (dc/change-stroke-attrs ids {:stroke-cap-start value} index)))
on-stroke-cap-end-change on-stroke-cap-end-change
(fn [index value] (fn [index value]
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/change-stroke-attrs ids {:stroke-cap-end value} index))) (st/emit! (dc/change-stroke-attrs ids {:stroke-cap-end value} index)))
on-stroke-cap-switch on-stroke-cap-switch
@ -140,10 +151,12 @@
stroke-cap-end (get-in values [:strokes index :stroke-cap-end])] stroke-cap-end (get-in values [:strokes index :stroke-cap-end])]
(when (and (not= stroke-cap-start :multiple) (when (and (not= stroke-cap-start :multiple)
(not= stroke-cap-end :multiple)) (not= stroke-cap-end :multiple))
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/change-stroke-attrs ids {:stroke-cap-start stroke-cap-end (st/emit! (dc/change-stroke-attrs ids {:stroke-cap-start stroke-cap-end
:stroke-cap-end stroke-cap-start} index))))) :stroke-cap-end stroke-cap-start} index)))))
on-add-stroke on-add-stroke
(fn [_] (fn [_]
(st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (dc/add-stroke ids {:stroke-alignment :inner (st/emit! (dc/add-stroke ids {:stroke-alignment :inner
:stroke-style :solid :stroke-style :solid
:stroke-color clr/black :stroke-color clr/black