Skip to content

Commit

Permalink
Hide decimal point for all draggable numbers if there is no fractiona…
Browse files Browse the repository at this point in the history
…l part. When dragging or hovering over fractional show.
  • Loading branch information
alcomposer committed Nov 25, 2024
1 parent 7d8c5aa commit 6357b43
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Source/Components/DraggableNumber.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,12 @@ class DraggableNumber : public Label
nvgTextLetterSpacing(nvg, 0.275f);
nvgTextAlign(nvg, NVG_ALIGN_MIDDLE | NVG_ALIGN_LEFT);
nvgFillColor(nvg, NVGComponent::convertColour(textColour));
nvgText(nvg, textArea.getX(), textArea.getCentreY() + 1.5f, numberText.toRawUTF8(), nullptr);

// Only display the decimal point if fractional exists, but make sure to show it as a user hovers over the fractional decimal places
auto formatedNumber = isMouseOverOrDragging() && hoveredDecimal > 0 ? numberText : String(numberText.getDoubleValue(), 0);
std::cout << "hoveredDecimal: " << hoveredDecimal << std::endl;

nvgText(nvg, textArea.getX(), textArea.getCentreY() + 1.5f, formatedNumber.toRawUTF8(), nullptr);

if (dragMode == Regular) {
textArea = textArea.withTrimmedLeft(numberTextLength);
Expand Down

0 comments on commit 6357b43

Please sign in to comment.