Skip to content

Commit

Permalink
quickfix for occasional color reset to white on recomposition
Browse files Browse the repository at this point in the history
On rare occasions, (was seen using a color picker in an animated
widget) the color picker will reset the selected color to white after a
recomposition.

This seems to be due to onSizeChanged() being called, even though the
color picker did not really change size.

For the HSV color picker it is possible to re-select automatically the
previously picked color, since the coordinates can be calculated. For
the ImageColorPicker, a more elaborate fix would be needed.
  • Loading branch information
sderr committed May 8, 2024
1 parent 775f779 commit 73e0f79
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ public class ColorPickerController {
}
paletteBitmap = resized.asImageBitmap()
copiedBitmap.recycle()
selectCenter(fromUser = false)
if (isHsvColorPalette) {
selectByColor(_selectedColor.value, false)
} else {
selectCenter(fromUser = false)
}
reviseTick.intValue++
}

Expand Down

0 comments on commit 73e0f79

Please sign in to comment.