Skip to content

Commit

Permalink
Add comments to selectByColor method
Browse files Browse the repository at this point in the history
  • Loading branch information
ruigoncalo committed Nov 23, 2023
1 parent 3f7fa70 commit 859345c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
}
Expand Down

0 comments on commit 859345c

Please sign in to comment.