Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
bug: Fix color picker preview (#2193)
Browse files Browse the repository at this point in the history
by scorbett123

closes #2190 and #2189
  • Loading branch information
scorbett123 authored Apr 7, 2021
1 parent 257efda commit 17a3108
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,12 @@ object ColorPicker : TitledWindow("Color Picker", 0.0f, 0.0f, 200.0f, 200.0f, Se
private fun drawColorPreview(vertexHelper: VertexHelper) {
RenderUtils2D.prepareGl()

// Previous color
val prevColor = setting?.value?.clone()?.apply { a = 255 }
RenderUtils2D.drawRectFilled(vertexHelper, prevColorPos.first.toVec2d(), prevColorPos.second.toVec2d(), prevColor
RenderUtils2D.drawRectFilled(vertexHelper, prevColorPos.first.toVec2d(), prevColorPos.second.toVec2d(), originalColor
?: ColorHolder())
RenderUtils2D.drawRectOutline(vertexHelper, prevColorPos.first.toVec2d(), prevColorPos.second.toVec2d(), 1.5f, GuiColors.outline)

// Current color
val currentColor = ColorHolder(r.value, g.value, b.value)
val currentColor = setting?.value ?: ColorHolder()
RenderUtils2D.drawRectFilled(vertexHelper, currentColorPos.first.toVec2d(), currentColorPos.second.toVec2d(), currentColor)
RenderUtils2D.drawRectOutline(vertexHelper, currentColorPos.first.toVec2d(), currentColorPos.second.toVec2d(), 1.5f, GuiColors.outline)

Expand Down

0 comments on commit 17a3108

Please sign in to comment.