mirror of
https://github.com/penpot/penpot.git
synced 2025-01-20 13:42:59 -05:00
💄 allow colorpicker to fill inline space
This commit is contained in:
parent
16a90f5e17
commit
a77dd138b8
3 changed files with 26 additions and 24 deletions
|
@ -47,5 +47,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.sliders-wrapper {
|
.sliders-wrapper {
|
||||||
@include flexColumn;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,27 +51,27 @@
|
||||||
value (+ min-value (* unit-value (- max-value min-value)))]
|
value (+ min-value (* unit-value (- max-value min-value)))]
|
||||||
(on-change value))))]
|
(on-change value))))]
|
||||||
|
|
||||||
[:div {:class (stl/css-case :opacity-wrapper (= type :opacity))}
|
|
||||||
[:div {:class (dm/str class (stl/css-case :vertical vertical?
|
|
||||||
:slider-selector true
|
|
||||||
:hue (= type :hue)
|
|
||||||
:opacity (= type :opacity)
|
|
||||||
:value (= type :value)))
|
|
||||||
:on-pointer-down handle-start-drag
|
|
||||||
:on-pointer-up handle-stop-drag
|
|
||||||
:on-lost-pointer-capture handle-stop-drag
|
|
||||||
:on-click calculate-pos
|
|
||||||
:on-pointer-move #(when @dragging? (calculate-pos %))}
|
|
||||||
(let [value-percent (* (/ (- value min-value)
|
|
||||||
(- max-value min-value)) 100)
|
|
||||||
|
|
||||||
value-percent (if reverse?
|
[:div {:class (dm/str class (stl/css-case :vertical vertical?
|
||||||
(mth/abs (- value-percent 100))
|
:slider-selector true
|
||||||
value-percent)
|
:hue (= type :hue)
|
||||||
value-percent-str (str value-percent "%")
|
:opacity (= type :opacity)
|
||||||
|
:value (= type :value)))
|
||||||
|
:on-pointer-down handle-start-drag
|
||||||
|
:on-pointer-up handle-stop-drag
|
||||||
|
:on-lost-pointer-capture handle-stop-drag
|
||||||
|
:on-click calculate-pos
|
||||||
|
:on-pointer-move #(when @dragging? (calculate-pos %))}
|
||||||
|
(let [value-percent (* (/ (- value min-value)
|
||||||
|
(- max-value min-value)) 100)
|
||||||
|
|
||||||
style-common #js {:pointerEvents "none"}
|
value-percent (if reverse?
|
||||||
style-horizontal (obj/merge! #js {:left value-percent-str} style-common)
|
(mth/abs (- value-percent 100))
|
||||||
style-vertical (obj/merge! #js {:bottom value-percent-str} style-common)]
|
value-percent)
|
||||||
[:div {:class (stl/css :handler)
|
value-percent-str (str value-percent "%")
|
||||||
:style (if vertical? style-vertical style-horizontal)}])]]))
|
|
||||||
|
style-common #js {:pointerEvents "none"}
|
||||||
|
style-horizontal (obj/merge! #js {:left value-percent-str} style-common)
|
||||||
|
style-vertical (obj/merge! #js {:bottom value-percent-str} style-common)]
|
||||||
|
[:div {:class (stl/css :handler)
|
||||||
|
:style (if vertical? style-vertical style-horizontal)}])]))
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
height: $s-24;
|
height: $s-24;
|
||||||
width: $s-200;
|
inline-size: 100%;
|
||||||
border: $s-2 solid var(--colorpicker-details-color);
|
border: $s-2 solid var(--colorpicker-details-color);
|
||||||
border-radius: $br-6;
|
border-radius: $br-6;
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
|
|
Loading…
Add table
Reference in a new issue