Skip to content

Commit fafbdf4

Browse files
committed
resetting to the previous color.
1 parent 6e7405d commit fafbdf4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

library/src/main/java/io/syslogic/colorpicker/compose/ColorPickerComponent.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ fun ColorPickerComponent(
8585
.padding(all = rowPadding * 4)
8686
) {
8787

88+
/* HSV */
8889
if (showHSV) {
8990
Column(
9091
horizontalAlignment = Alignment.Start,
@@ -146,6 +147,7 @@ fun ColorPickerComponent(
146147
}
147148
}
148149

150+
/* ARGB */
149151
if (showARGB) {
150152
Column(
151153
horizontalAlignment = Alignment.End,
@@ -366,7 +368,13 @@ fun ColorPickerComponent(
366368
.pointerInput(Unit) {
367369
detectTapGestures(
368370
onPress = {
369-
onButtonClick(context, OldColor, initialColor.value.toInt(), listener)
371+
/* reset to the previous color */
372+
onButtonClick(context, OldColor, initialColor.hashCode(), listener)
373+
currentColor = initialColor.hashCode()
374+
currentAlpha = initialColor.alpha
375+
currentHue = getHSV(initialColor)[0]
376+
currentSat = getHSV(initialColor)[1]
377+
currentVal = getHSV(initialColor)[2]
370378
}
371379
)
372380
}

0 commit comments

Comments
 (0)