mirror of
https://github.com/penpot/penpot.git
synced 2025-06-07 10:21:38 +02:00
✨ Colorpicker: remember las color mode
This commit is contained in:
parent
56a0d522dc
commit
c83d028466
3 changed files with 32 additions and 10 deletions
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
## 1.19.3
|
## 1.19.3
|
||||||
|
|
||||||
|
### :sparkles: New features
|
||||||
|
|
||||||
|
- Colorpicker: remember last color mode [Taiga #5508](https://tree.taiga.io/project/penpot/issue/5508)
|
||||||
|
|
||||||
### :bug: Bugs fixed
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
- List view is discarded on tab change on Workspace Assets Sidebar tab [Github #3547](https://github.com/penpot/penpot/issues/3547)
|
- List view is discarded on tab change on Workspace Assets Sidebar tab [Github #3547](https://github.com/penpot/penpot/issues/3547)
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
[app.main.data.workspace.texts :as dwt]
|
[app.main.data.workspace.texts :as dwt]
|
||||||
[app.main.data.workspace.undo :as dwu]
|
[app.main.data.workspace.undo :as dwu]
|
||||||
[app.util.color :as uc]
|
[app.util.color :as uc]
|
||||||
|
[app.util.storage :refer [storage]]
|
||||||
[beicon.core :as rx]
|
[beicon.core :as rx]
|
||||||
[potok.core :as ptk]))
|
[potok.core :as ptk]))
|
||||||
|
|
||||||
|
@ -647,3 +648,12 @@
|
||||||
:position :right})
|
:position :right})
|
||||||
(ptk/event ::ev/event {::ev/name "add-asset-to-library"
|
(ptk/event ::ev/event {::ev/name "add-asset-to-library"
|
||||||
:asset-type "color"}))))))
|
:asset-type "color"}))))))
|
||||||
|
|
||||||
|
(defn get-active-color-tab
|
||||||
|
[]
|
||||||
|
(let [tab (::tab @storage)]
|
||||||
|
(or tab :ramp)))
|
||||||
|
|
||||||
|
(defn set-active-color-tab!
|
||||||
|
[tab]
|
||||||
|
(swap! storage assoc ::tab tab))
|
||||||
|
|
|
@ -56,12 +56,17 @@
|
||||||
|
|
||||||
current-color (:current-color state)
|
current-color (:current-color state)
|
||||||
|
|
||||||
active-tab (mf/use-state :ramp #_:harmony #_:hsva)
|
active-tab (mf/use-state (dc/get-active-color-tab))
|
||||||
set-ramp-tab! (mf/use-fn #(reset! active-tab :ramp))
|
|
||||||
set-harmony-tab! (mf/use-fn #(reset! active-tab :harmony))
|
|
||||||
set-hsva-tab! (mf/use-fn #(reset! active-tab :hsva))
|
|
||||||
|
|
||||||
drag? (mf/use-state false)
|
drag? (mf/use-state false)
|
||||||
|
|
||||||
|
set-tab!
|
||||||
|
(mf/use-fn
|
||||||
|
(fn [event]
|
||||||
|
(let [tab (-> (dom/get-current-target event)
|
||||||
|
(dom/get-data "tab")
|
||||||
|
(keyword))]
|
||||||
|
(reset! active-tab tab)
|
||||||
|
(dc/set-active-color-tab! tab))))
|
||||||
|
|
||||||
handle-change-color
|
handle-change-color
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
@ -81,9 +86,9 @@
|
||||||
(fn []
|
(fn []
|
||||||
(if picking-color?
|
(if picking-color?
|
||||||
(do (modal/disallow-click-outside!)
|
(do (modal/disallow-click-outside!)
|
||||||
(st/emit! (dc/stop-picker)))
|
(st/emit! (dc/stop-picker)))
|
||||||
(do (modal/allow-click-outside!)
|
(do (modal/allow-click-outside!)
|
||||||
(st/emit! (dc/start-picker))))))
|
(st/emit! (dc/start-picker))))))
|
||||||
|
|
||||||
handle-change-stop
|
handle-change-stop
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
@ -225,15 +230,18 @@
|
||||||
[:div.colorpicker-tab.tooltip.tooltip-bottom.tooltip-expand
|
[:div.colorpicker-tab.tooltip.tooltip-bottom.tooltip-expand
|
||||||
{:class (when (= @active-tab :ramp) "active")
|
{:class (when (= @active-tab :ramp) "active")
|
||||||
:alt (tr "workspace.libraries.colors.rgba")
|
:alt (tr "workspace.libraries.colors.rgba")
|
||||||
:on-click set-ramp-tab!} i/picker-ramp]
|
:on-click set-tab!
|
||||||
|
:data-tab "ramp"} i/picker-ramp]
|
||||||
[:div.colorpicker-tab.tooltip.tooltip-bottom.tooltip-expand
|
[:div.colorpicker-tab.tooltip.tooltip-bottom.tooltip-expand
|
||||||
{:class (when (= @active-tab :harmony) "active")
|
{:class (when (= @active-tab :harmony) "active")
|
||||||
:alt (tr "workspace.libraries.colors.rgb-complementary")
|
:alt (tr "workspace.libraries.colors.rgb-complementary")
|
||||||
:on-click set-harmony-tab!} i/picker-harmony]
|
:on-click set-tab!
|
||||||
|
:data-tab "harmony"} i/picker-harmony]
|
||||||
[:div.colorpicker-tab.tooltip.tooltip-bottom.tooltip-expand
|
[:div.colorpicker-tab.tooltip.tooltip-bottom.tooltip-expand
|
||||||
{:class (when (= @active-tab :hsva) "active")
|
{:class (when (= @active-tab :hsva) "active")
|
||||||
:alt (tr "workspace.libraries.colors.hsv")
|
:alt (tr "workspace.libraries.colors.hsv")
|
||||||
:on-click set-hsva-tab!} i/picker-hsv]]
|
:on-click set-tab!
|
||||||
|
:data-tab "hsva"} i/picker-hsv]]
|
||||||
|
|
||||||
(if picking-color?
|
(if picking-color?
|
||||||
[:div.picker-detail-wrapper
|
[:div.picker-detail-wrapper
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue