From 859345cde7c27541bbc5ece00a9aaf3f8319fb89 Mon Sep 17 00:00:00 2001 From: ruigoncalo Date: Thu, 23 Nov 2023 19:34:44 +0000 Subject: [PATCH] Add comments to selectByColor method --- .../skydoves/colorpicker/compose/ColorPickerController.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorPickerController.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorPickerController.kt index 17bf34e..007d474 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorPickerController.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorPickerController.kt @@ -210,6 +210,12 @@ public class ColorPickerController { } } + /** + * Select a specific color and update with the selected color. + * + * @param color Color to be selected. + * @param fromUser Represents this event is triggered by user or not. + */ public fun selectByColor(color: Color, fromUser: Boolean) { val palette = paletteBitmap if (palette != null) { @@ -228,7 +234,6 @@ public class ColorPickerController { val y = saturationVector * sin(angle) + (palette.height / 2) selectByCoordinate(x.toFloat(), y.toFloat(), fromUser) - // select brightness val brightness = max(max(color.red, color.green), color.blue) setBrightness(brightness, fromUser = false) }