| 1542 | } |
| 1543 | |
| 1544 | void LfoEditor::invertShape(bool invertX, bool invertY) |
| 1545 | { |
| 1546 | if (! dataIsActive || activeLfoData.points.size() < 2) |
| 1547 | return; |
| 1548 | |
| 1549 | for (auto& point : activeLfoData.points) |
| 1550 | { |
| 1551 | if (invertX) |
| 1552 | { |
| 1553 | // We don't invert the first and last points on the x-axis |
| 1554 | // because they are fixed at 0.0 and 1.0. |
| 1555 | if (! juce::approximatelyEqual(point.x, 0.0f) && ! juce::approximatelyEqual(point.x, 1.0f)) |
| 1556 | { |
| 1557 | point.x = 1.0f - point.x; |
| 1558 | } |
| 1559 | } |
| 1560 | |
| 1561 | if (invertY) |
| 1562 | { |
| 1563 | point.y = 1.0f - point.y; |
| 1564 | } |
| 1565 | } |
| 1566 | |
| 1567 | // Inverting X will mess up the order, so we need to sort again. |
| 1568 | if (invertX) |
| 1569 | { |
| 1570 | // Swap the y-values of the first and last points. |
| 1571 | std::swap(activeLfoData.points.front().y, activeLfoData.points.back().y); |
| 1572 | |
| 1573 | updateAndSortPoints(); |
| 1574 | |
| 1575 | // Invert curvatures when inverting horizontally. |
| 1576 | std::reverse(activeLfoData.curvatures.begin(), activeLfoData.curvatures.end()); |
| 1577 | for (auto& curvature : activeLfoData.curvatures) |
| 1578 | { |
| 1579 | curvature = -curvature; |
| 1580 | } |
| 1581 | } |
| 1582 | |
| 1583 | repaint(); |
| 1584 | } |
| 1585 | |
| 1586 | void LfoPanel::handleAsyncUpdate() |
| 1587 | { |
nothing calls this directly
no outgoing calls
no test coverage detected