Skip to content

Commit

Permalink
Add BasicColorPicker.setShowColorPreviews()
Browse files Browse the repository at this point in the history
  • Loading branch information
cypherdare committed Sep 22, 2020
1 parent 2b91e66 commit 068a3ef
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public class BasicColorPicker extends VisTable implements Disposable {

private boolean allowAlphaEdit = false;
private boolean showHexFields = true;
private boolean showColorPreviews = true;

private boolean disposed = false;

Expand Down Expand Up @@ -144,8 +145,11 @@ private void rebuildMainTable () {
mainTable.clearChildren();
mainTable.add(palette).size(PALETTE_SIZE * sizes.scaleFactor);
mainTable.add(verticalBar).size(VERTICAL_BAR_WIDTH * sizes.scaleFactor, PALETTE_SIZE * sizes.scaleFactor).top();
mainTable.row();
mainTable.add(colorPreviewsTable).colspan(2).expandX().fillX();

if (showColorPreviews) {
mainTable.row();
mainTable.add(colorPreviewsTable).colspan(2).expandX().fillX();
}

if (showHexFields) {
mainTable.row();
Expand Down Expand Up @@ -301,6 +305,16 @@ public boolean isShowHexFields () {
return showHexFields;
}

public void setShowColorPreviews(boolean showColorPreviews) {
this.showColorPreviews = showColorPreviews;
colorPreviewsTable.setVisible(showColorPreviews);
rebuildMainTable();
}

public boolean isShowColorPreviews() {
return showColorPreviews;
}

@Override
public void draw (Batch batch, float parentAlpha) {
boolean wasPedantic = ShaderProgram.pedantic;
Expand Down

0 comments on commit 068a3ef

Please sign in to comment.