[sequence] Restore margins on the sequence graph

This commit is contained in:
Gabriel Ozouf
2020-12-02 12:32:29 +01:00
committed by LeaNumworks
parent f3b770cb29
commit 316d054935
3 changed files with 4 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ public:
CurveViewRange(Shared::InteractiveCurveViewRangeDelegate * delegate = nullptr);
void normalize(bool forceChangeY = false) override;
private:
virtual bool defaultRangeCriteria() const override { return false; }
constexpr static float k_displayLeftMarginRatio = 0.1f;
};

View File

@@ -183,7 +183,7 @@ void InteractiveCurveViewRange::setDefault() {
m_delegate->interestingRanges(this);
/* If the horizontal bounds are integers, they are preset values and should
* not be changed. */
bool isDefaultRange = (xMin() == std::round(xMin())) && (xMax() == std::round(xMax()));
bool isDefaultRange = defaultRangeCriteria();
// Add margins, then round limits.
float newXMin = xMin(), newXMax = xMax();

View File

@@ -78,6 +78,8 @@ protected:
* 2 * 1 unit -> 10.0mm
* So normalizedYHalfRange = 43.2mm * 170/240 * 1 unit / 10.0mm */
constexpr static float NormalizedYHalfRange(float unit) { return 3.06f * unit; }
virtual bool defaultRangeCriteria() const { return (xMin() == std::round(xMin())) && (xMax() == std::round(xMax())); }
InteractiveCurveViewRangeDelegate * m_delegate;
private:
float offscreenYAxis() const override { return m_offscreenYAxis; }