Skip to content

Commit

Permalink
Sequencer: Animate buttons on press
Browse files Browse the repository at this point in the history
When you click a button, expand its size to give feedback that it's
pressed.

Expanding looks better than shifting it down. Native imgui buttons use a
different colour on press, but there's so little color to the AddDel
button that you can't see it.
  • Loading branch information
idbrii committed Oct 22, 2022
1 parent 4cda4b7 commit 43d8af4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ImSequencer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ namespace ImSequencer
bool containedClick = overBtn && btnRect.Contains(io.MouseClickedPos[0]);
bool clickedBtn = containedClick && io.MouseReleased[0];
int btnColor = overBtn ? 0xAAEAFFAA : 0x77A3B2AA;
if (containedClick && io.MouseDownDuration[0] > 0)
btnRect.Expand(2.0f);

float midy = pos.y + 16 / 2 - 0.5f;
float midx = pos.x + 16 / 2 - 0.5f;
Expand Down

0 comments on commit 43d8af4

Please sign in to comment.