mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/interactive_curve_view_range] Status markers
Add member variable m_zoomAuto and m_zoomNormalized to remember the interactive range's status. Change-Id: I77c43ddd683d3c6011742801139d23f5e20c99fe
This commit is contained in:
committed by
Émilie Feral
parent
13d1b7077c
commit
e2725c8e61
@@ -19,12 +19,10 @@ uint32_t InteractiveCurveViewRange::rangeChecksum() {
|
||||
|
||||
void InteractiveCurveViewRange::setXMin(float xMin) {
|
||||
MemoizedCurveViewRange::protectedSetXMin(xMin, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
notifyRangeChange();
|
||||
}
|
||||
|
||||
void InteractiveCurveViewRange::setXMax(float xMax) {
|
||||
MemoizedCurveViewRange::protectedSetXMax(xMax, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
notifyRangeChange();
|
||||
}
|
||||
|
||||
void InteractiveCurveViewRange::setYMin(float yMin) {
|
||||
@@ -176,10 +174,10 @@ void InteractiveCurveViewRange::panToMakePointVisible(float x, float y, float to
|
||||
}
|
||||
}
|
||||
|
||||
void InteractiveCurveViewRange::notifyRangeChange() {
|
||||
if (m_delegate) {
|
||||
m_delegate->didChangeRange(this);
|
||||
}
|
||||
void InteractiveCurveViewRange::checkForNormalizedRange() {
|
||||
float pixelHeight = std::round(Ion::Display::Height * (NormalizedYHalfRange(100.f) / Ion::Display::HeightInTenthOfMillimeter));
|
||||
float pixelWidth = std::round(Ion::Display::Width * (NormalizedXHalfRange(100.f) / Ion::Display::WidthInTenthOfMillimeter));
|
||||
m_zoomNormalize = std::round(pixelHeight * (xMax() - xMin())) == std::round(pixelWidth * (yMax() - yMin()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,12 +13,19 @@ class InteractiveCurveViewRange : public MemoizedCurveViewRange {
|
||||
public:
|
||||
InteractiveCurveViewRange(InteractiveCurveViewRangeDelegate * delegate = nullptr) :
|
||||
MemoizedCurveViewRange(),
|
||||
m_delegate(delegate)
|
||||
m_delegate(delegate),
|
||||
m_zoomAuto(true),
|
||||
m_zoomNormalize(false)
|
||||
{}
|
||||
|
||||
void setDelegate(InteractiveCurveViewRangeDelegate * delegate) { m_delegate = delegate; }
|
||||
uint32_t rangeChecksum() override;
|
||||
|
||||
bool zoomAuto() const { return m_zoomAuto; }
|
||||
void setZoomAuto(bool v) { m_zoomAuto = v; }
|
||||
bool zoomNormalize() const { return m_zoomNormalize; }
|
||||
void setZoomNormalize(bool v) { m_zoomNormalize = v; }
|
||||
|
||||
// CurveViewWindow
|
||||
void setXMin(float f) override;
|
||||
void setXMax(float f) override;
|
||||
@@ -32,6 +39,8 @@ public:
|
||||
virtual void setDefault();
|
||||
void centerAxisAround(Axis axis, float position);
|
||||
void panToMakePointVisible(float x, float y, float topMarginRatio, float rightMarginRatio, float bottomMarginRation, float leftMarginRation, float pixelWidth);
|
||||
void checkForNormalizedRange();
|
||||
|
||||
protected:
|
||||
constexpr static float k_upperMaxFloat = 1E+8f;
|
||||
constexpr static float k_lowerMaxFloat = 9E+7f;
|
||||
@@ -53,7 +62,8 @@ protected:
|
||||
constexpr static float NormalizedYHalfRange(float unit) { return 3.06f * unit; }
|
||||
InteractiveCurveViewRangeDelegate * m_delegate;
|
||||
private:
|
||||
void notifyRangeChange();
|
||||
bool m_zoomAuto;
|
||||
bool m_zoomNormalize;
|
||||
};
|
||||
|
||||
static_assert(Ion::Display::WidthInTenthOfMillimeter == 576, "Use the new screen width to compute Shared::InteractiveCurveViewRange::NormalizedXHalfRange");
|
||||
|
||||
@@ -81,6 +81,9 @@ int RangeParameterController::reusableParameterCellCount(int type) {
|
||||
|
||||
void RangeParameterController::buttonAction() {
|
||||
*m_interactiveRange = m_tempInteractiveRange;
|
||||
m_interactiveRange->setZoomAuto(false);
|
||||
m_interactiveRange->checkForNormalizedRange();
|
||||
|
||||
StackViewController * stack = stackController();
|
||||
stack->pop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user