mirror of
https://github.com/penpot/penpot.git
synced 2025-06-13 13:11:40 +02:00
🐛 Fix problem with selection colors and texts
This commit is contained in:
parent
92baf75ccd
commit
66444e27b1
3 changed files with 35 additions and 19 deletions
|
@ -64,6 +64,7 @@
|
||||||
- Fix dashboard left sidebar, the [x] overlaps the field [Taiga #5064](https://tree.taiga.io/project/penpot/issue/5064)
|
- Fix dashboard left sidebar, the [x] overlaps the field [Taiga #5064](https://tree.taiga.io/project/penpot/issue/5064)
|
||||||
- Fix expanded typography on assets sidebar is moving [Taiga #5063](https://tree.taiga.io/project/penpot/issue/5063)
|
- Fix expanded typography on assets sidebar is moving [Taiga #5063](https://tree.taiga.io/project/penpot/issue/5063)
|
||||||
- Fix spelling mistake in confirmation after importing only 1 file [Taiga #5095](https://tree.taiga.io/project/penpot/issue/5095)
|
- Fix spelling mistake in confirmation after importing only 1 file [Taiga #5095](https://tree.taiga.io/project/penpot/issue/5095)
|
||||||
|
- Fix problem with selection colors and texts [Taiga #5079](https://tree.taiga.io/project/penpot/issue/5079)
|
||||||
|
|
||||||
### :heart: Community contributions by (Thank you!)
|
### :heart: Community contributions by (Thank you!)
|
||||||
- To @ondrejkonec: for contributing to the code with:
|
- To @ondrejkonec: for contributing to the code with:
|
||||||
|
|
|
@ -161,27 +161,37 @@
|
||||||
|
|
||||||
on-change
|
on-change
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(fn [new-color old-color]
|
(fn [new-color old-color from-picker?]
|
||||||
(let [old-color (-> old-color
|
(let [old-color (-> old-color
|
||||||
(dissoc :name)
|
(dissoc :name)
|
||||||
(dissoc :path)
|
(dissoc :path)
|
||||||
(d/without-nils))
|
(d/without-nils))
|
||||||
|
|
||||||
prev-color (-> @prev-color*
|
prev-color (when @prev-color*
|
||||||
(dissoc :name)
|
(-> @prev-color*
|
||||||
(dissoc :path)
|
(dissoc :name)
|
||||||
(d/without-nils))
|
(dissoc :path)
|
||||||
|
(d/without-nils)))
|
||||||
|
|
||||||
;; When dragging on the color picker sometimes all the shapes hasn't updated the color to the prev value so we need this extra calculation
|
;; When dragging on the color picker sometimes all the shapes hasn't updated the color to the prev value so we need this extra calculation
|
||||||
shapes-by-old-color (get @grouped-colors* old-color)
|
shapes-by-old-color (get @grouped-colors* old-color)
|
||||||
shapes-by-prev-color (get @grouped-colors* prev-color)
|
shapes-by-prev-color (get @grouped-colors* prev-color)
|
||||||
shapes-by-color (or shapes-by-prev-color shapes-by-old-color)]
|
shapes-by-color (or shapes-by-prev-color shapes-by-old-color)]
|
||||||
(reset! prev-color* new-color)
|
|
||||||
(st/emit! (dc/change-color-in-selected new-color shapes-by-color old-color)))))
|
|
||||||
|
|
||||||
on-open (mf/use-fn
|
(when from-picker?
|
||||||
(fn [color]
|
(reset! prev-color* new-color))
|
||||||
(reset! prev-color* color)))
|
|
||||||
|
(st/emit! (dc/change-color-in-selected new-color shapes-by-color (or prev-color old-color))))))
|
||||||
|
|
||||||
|
on-open
|
||||||
|
(mf/use-fn
|
||||||
|
(fn []
|
||||||
|
(reset! prev-color* nil)))
|
||||||
|
|
||||||
|
on-close
|
||||||
|
(mf/use-fn
|
||||||
|
(fn []
|
||||||
|
(reset! prev-color* nil)))
|
||||||
|
|
||||||
on-detach
|
on-detach
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
@ -212,8 +222,9 @@
|
||||||
:index index
|
:index index
|
||||||
:on-detach on-detach
|
:on-detach on-detach
|
||||||
:select-only select-only
|
:select-only select-only
|
||||||
:on-change #(on-change % color)
|
:on-change #(on-change %1 color %2)
|
||||||
:on-open on-open}])
|
:on-open on-open
|
||||||
|
:on-close on-close}])
|
||||||
(when (and (false? @expand-lib-color) (< 3 (count library-colors)))
|
(when (and (false? @expand-lib-color) (< 3 (count library-colors)))
|
||||||
[:div.expand-colors {:on-click #(reset! expand-lib-color true)}
|
[:div.expand-colors {:on-click #(reset! expand-lib-color true)}
|
||||||
[:span i/actions]
|
[:span i/actions]
|
||||||
|
@ -225,8 +236,9 @@
|
||||||
:index index
|
:index index
|
||||||
:on-detach on-detach
|
:on-detach on-detach
|
||||||
:select-only select-only
|
:select-only select-only
|
||||||
:on-change #(on-change % color)
|
:on-change #(on-change %1 color %2)
|
||||||
:on-open on-open}]))]
|
:on-open on-open
|
||||||
|
:on-close on-close}]))]
|
||||||
|
|
||||||
[:div.selected-colors
|
[:div.selected-colors
|
||||||
(for [[index color] (d/enumerate (take 3 colors))]
|
(for [[index color] (d/enumerate (take 3 colors))]
|
||||||
|
@ -234,8 +246,9 @@
|
||||||
:color color
|
:color color
|
||||||
:index index
|
:index index
|
||||||
:select-only select-only
|
:select-only select-only
|
||||||
:on-change #(on-change % color)
|
:on-change #(on-change %1 color %2)
|
||||||
:on-open on-open}])
|
:on-open on-open
|
||||||
|
:on-close on-close}])
|
||||||
(when (and (false? @expand-color) (< 3 (count colors)))
|
(when (and (false? @expand-color) (< 3 (count colors)))
|
||||||
[:div.expand-colors {:on-click #(reset! expand-color true)}
|
[:div.expand-colors {:on-click #(reset! expand-color true)}
|
||||||
[:span i/actions]
|
[:span i/actions]
|
||||||
|
@ -246,5 +259,6 @@
|
||||||
:color color
|
:color color
|
||||||
:index index
|
:index index
|
||||||
:select-only select-only
|
:select-only select-only
|
||||||
:on-change #(on-change % color)
|
:on-change #(on-change %1 color %2)
|
||||||
:on-open on-open}]))]]])))
|
:on-open on-open
|
||||||
|
:on-close on-close}]))]]])))
|
||||||
|
|
|
@ -113,7 +113,8 @@
|
||||||
:y y
|
:y y
|
||||||
:disable-gradient disable-gradient
|
:disable-gradient disable-gradient
|
||||||
:disable-opacity disable-opacity
|
:disable-opacity disable-opacity
|
||||||
:on-change #(on-change (merge uc/empty-color %))
|
;; on-change second parameter means if the source is the color-picker
|
||||||
|
:on-change #(on-change (merge uc/empty-color %) true)
|
||||||
:on-close (fn [value opacity id file-id]
|
:on-close (fn [value opacity id file-id]
|
||||||
(when on-close
|
(when on-close
|
||||||
(on-close value opacity id file-id)))
|
(on-close value opacity id file-id)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue