mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
🐛 Fix some limit situations on shadow reorder
This commit is contained in:
parent
a09dd953ff
commit
1dab570907
3 changed files with 58 additions and 29 deletions
|
@ -24,6 +24,7 @@
|
||||||
- Removed sizing variables from radius (by @ondrejkonec) [Github #3184](https://github.com/penpot/penpot/pull/3184)
|
- Removed sizing variables from radius (by @ondrejkonec) [Github #3184](https://github.com/penpot/penpot/pull/3184)
|
||||||
- Dashboard search, set focus after shortcut (by @akshay-gupta7) [Github #3196](https://github.com/penpot/penpot/pull/3196)
|
- Dashboard search, set focus after shortcut (by @akshay-gupta7) [Github #3196](https://github.com/penpot/penpot/pull/3196)
|
||||||
- Library name dropdown arrow is overlapped by library name (by @ondrejkonec) [Taiga #5200](https://tree.taiga.io/project/penpot/issue/5200)
|
- Library name dropdown arrow is overlapped by library name (by @ondrejkonec) [Taiga #5200](https://tree.taiga.io/project/penpot/issue/5200)
|
||||||
|
- Reorder shadows (by @akshay-gupta7) [Github #3236](https://github.com/penpot/penpot/pull/3236)
|
||||||
|
|
||||||
## 1.18.3
|
## 1.18.3
|
||||||
|
|
||||||
|
|
|
@ -786,7 +786,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-option {
|
.grid-option,
|
||||||
|
.shadow-option {
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
.advanced-options {
|
.advanced-options {
|
||||||
.row-flex {
|
.row-flex {
|
||||||
|
@ -797,6 +798,15 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 12px;
|
top: 12px;
|
||||||
}
|
}
|
||||||
|
.element-set-actions-button {
|
||||||
|
min-width: auto;
|
||||||
|
min-height: auto;
|
||||||
|
padding-right: 10px;
|
||||||
|
svg {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -807,7 +817,8 @@
|
||||||
margin-left: 0.25rem;
|
margin-left: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.element-set-content .grid-option-main {
|
.element-set-content .grid-option-main,
|
||||||
|
.element-set-content .shadow-option-main {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 0.3rem 0;
|
padding: 0.3rem 0;
|
||||||
|
@ -857,11 +868,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-option-main-actions {
|
.grid-option-main-actions,
|
||||||
|
.shadow-option-main-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
|
|
||||||
.grid-option:hover & {
|
.grid-option:hover &,
|
||||||
|
.shadow-option:hover & {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
[app.main.ui.workspace.sidebar.options.rows.color-row :refer [color-row]]
|
[app.main.ui.workspace.sidebar.options.rows.color-row :refer [color-row]]
|
||||||
[app.util.dom :as dom]
|
[app.util.dom :as dom]
|
||||||
[app.util.i18n :as i18n :refer [tr]]
|
[app.util.i18n :as i18n :refer [tr]]
|
||||||
|
[okulary.core :as l]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
(def shadow-attrs [:shadow])
|
(def shadow-attrs [:shadow])
|
||||||
|
@ -45,10 +46,8 @@
|
||||||
(mapv second)))
|
(mapv second)))
|
||||||
|
|
||||||
(mf/defc shadow-entry
|
(mf/defc shadow-entry
|
||||||
[{:keys [ids index value on-reorder disable-drag? on-blur]}]
|
[{:keys [ids index value on-reorder disable-drag? on-blur open-state-ref]}]
|
||||||
(let [open-shadow (mf/use-state false)
|
(let [basic-offset-x-ref (mf/use-ref nil)
|
||||||
|
|
||||||
basic-offset-x-ref (mf/use-ref nil)
|
|
||||||
basic-offset-y-ref (mf/use-ref nil)
|
basic-offset-y-ref (mf/use-ref nil)
|
||||||
basic-blur-ref (mf/use-ref nil)
|
basic-blur-ref (mf/use-ref nil)
|
||||||
|
|
||||||
|
@ -58,6 +57,12 @@
|
||||||
adv-spread-ref (mf/use-ref nil)
|
adv-spread-ref (mf/use-ref nil)
|
||||||
|
|
||||||
shadow-style (dm/str (:style value))
|
shadow-style (dm/str (:style value))
|
||||||
|
shadow-id (:id value)
|
||||||
|
|
||||||
|
open-status-ref (mf/with-memo [open-state-ref shadow-id]
|
||||||
|
(-> (l/key shadow-id)
|
||||||
|
(l/derived open-state-ref)))
|
||||||
|
open-shadow (mf/deref open-status-ref)
|
||||||
|
|
||||||
on-remove-shadow
|
on-remove-shadow
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
@ -125,15 +130,19 @@
|
||||||
toggle-visibility
|
toggle-visibility
|
||||||
(fn [index]
|
(fn [index]
|
||||||
(fn []
|
(fn []
|
||||||
(st/emit! (dch/update-shapes ids #(update-in % [:shadow index :hidden] not)))))]
|
(st/emit! (dch/update-shapes ids #(update-in % [:shadow index :hidden] not)))))
|
||||||
|
|
||||||
|
on-toggle-open-shadow
|
||||||
|
(fn []
|
||||||
|
(swap! open-state-ref update shadow-id not))]
|
||||||
[:*
|
[:*
|
||||||
[:div.border-data {:class (dom/classnames
|
[:div.shadow-option {:class (dom/classnames
|
||||||
:dnd-over-top (= (:over dprops) :top)
|
:dnd-over-top (= (:over dprops) :top)
|
||||||
:dnd-over-bot (= (:over dprops) :bot))
|
:dnd-over-bot (= (:over dprops) :bot))
|
||||||
:ref dref}
|
:ref dref}
|
||||||
[:div.element-set-options-group {:style {:display (when @open-shadow "none")}}
|
[:div.shadow-option-main {:style {:display (when open-shadow "none")}}
|
||||||
[:div.element-set-actions-button
|
[:div.element-set-actions-button
|
||||||
{:on-click #(reset! open-shadow true)}
|
{:on-click on-toggle-open-shadow}
|
||||||
i/actions]
|
i/actions]
|
||||||
|
|
||||||
[:select.input-select
|
[:select.input-select
|
||||||
|
@ -148,7 +157,7 @@
|
||||||
:selected (when (= shadow-style ":inner-shadow") "selected")}
|
:selected (when (= shadow-style ":inner-shadow") "selected")}
|
||||||
(tr "workspace.options.shadow-options.inner-shadow")]]
|
(tr "workspace.options.shadow-options.inner-shadow")]]
|
||||||
|
|
||||||
[:div.element-set-actions
|
[:div.shadow-option-main-actions
|
||||||
[:div.element-set-actions-button {:on-click (toggle-visibility index)}
|
[:div.element-set-actions-button {:on-click (toggle-visibility index)}
|
||||||
(if (:hidden value) i/eye-closed i/eye)]
|
(if (:hidden value) i/eye-closed i/eye)]
|
||||||
[:div.element-set-actions-button
|
[:div.element-set-actions-button
|
||||||
|
@ -156,19 +165,23 @@
|
||||||
:on-click on-remove-shadow}
|
:on-click on-remove-shadow}
|
||||||
i/minus]]]
|
i/minus]]]
|
||||||
|
|
||||||
[:& advanced-options {:visible? @open-shadow
|
[:& advanced-options {:visible? open-shadow
|
||||||
:on-close #(reset! open-shadow false)}
|
:on-close on-toggle-open-shadow}
|
||||||
[:div.color-data
|
[:div.color-data
|
||||||
[:div.element-set-actions-button
|
[:div.element-set-actions-button
|
||||||
{:on-click #(reset! open-shadow false)}
|
{:on-click on-toggle-open-shadow}
|
||||||
i/actions]
|
i/actions]
|
||||||
[:select.input-select
|
[:select.input-select
|
||||||
{:default-value (str (:style value))
|
{:default-value shadow-style
|
||||||
:on-change (fn [event]
|
:on-change (fn [event]
|
||||||
(let [value (-> event dom/get-target dom/get-value d/read-string)]
|
(let [value (-> event dom/get-target dom/get-value d/read-string)]
|
||||||
(st/emit! (dch/update-shapes ids #(assoc-in % [:shadow index :style] value)))))}
|
(st/emit! (dch/update-shapes ids #(assoc-in % [:shadow index :style] value)))))}
|
||||||
[:option {:value ":drop-shadow"} (tr "workspace.options.shadow-options.drop-shadow")]
|
[:option {:value ":drop-shadow"
|
||||||
[:option {:value ":inner-shadow"} (tr "workspace.options.shadow-options.inner-shadow")]]]
|
:selected (when (= shadow-style ":drop-shadow") "selected")}
|
||||||
|
(tr "workspace.options.shadow-options.drop-shadow")]
|
||||||
|
[:option {:value ":inner-shadow"
|
||||||
|
:selected (when (= shadow-style ":inner-shadow") "selected")}
|
||||||
|
(tr "workspace.options.shadow-options.inner-shadow")]]]
|
||||||
|
|
||||||
[:div.row-grid-2
|
[:div.row-grid-2
|
||||||
[:div.input-element {:title (tr "workspace.options.shadow-options.offsetx")}
|
[:div.input-element {:title (tr "workspace.options.shadow-options.offsetx")}
|
||||||
|
@ -232,6 +245,7 @@
|
||||||
values (unchecked-get props "values")
|
values (unchecked-get props "values")
|
||||||
|
|
||||||
shadows (:shadow values [])
|
shadows (:shadow values [])
|
||||||
|
open-state-ref (mf/with-memo [] (l/atom {}))
|
||||||
|
|
||||||
disable-drag* (mf/use-state false)
|
disable-drag* (mf/use-state false)
|
||||||
disable-drag? (deref disable-drag*)
|
disable-drag? (deref disable-drag*)
|
||||||
|
@ -288,4 +302,5 @@
|
||||||
:on-reorder handle-reorder
|
:on-reorder handle-reorder
|
||||||
:disable-drag? disable-drag?
|
:disable-drag? disable-drag?
|
||||||
:on-blur on-blur
|
:on-blur on-blur
|
||||||
:index index}])]])]))
|
:index index
|
||||||
|
:open-state-ref open-state-ref}])]])]))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue