Mercurial > hg > svgui
diff layer/NoteLayer.cpp @ 1315:1d7921b1852f
Ensure scale appears for layer when drawn in AutoAlign mode without any other layer present to align to
author | Chris Cannam |
---|---|
date | Wed, 04 Jul 2018 15:34:16 +0100 |
parents | a34a2a25907c |
children | c39f2d439d59 |
line wrap: on
line diff
--- a/layer/NoteLayer.cpp Wed Jul 04 15:33:47 2018 +0100 +++ b/layer/NoteLayer.cpp Wed Jul 04 15:34:16 2018 +0100 @@ -61,7 +61,7 @@ m_scaleMinimum(0), m_scaleMaximum(0) { - SVDEBUG << "constructed NoteLayer" << endl; + SVDEBUG << "constructed NoteLayer" << endl; } void @@ -833,14 +833,18 @@ int NoteLayer::getVerticalScaleWidth(LayerGeometryProvider *v, bool, QPainter &paint) const { - if (!m_model || shouldAutoAlign()) { + if (!m_model) { return 0; - } else { - if (m_verticalScale == LogScale || m_verticalScale == MIDIRangeScale) { - return LogNumericalScale().getWidth(v, paint) + 10; // for piano - } else { - return LinearNumericalScale().getWidth(v, paint); - } + } + + if (shouldAutoAlign() && !valueExtentsMatchMine(v)) { + return 0; + } + + if (m_verticalScale == LogScale || m_verticalScale == MIDIRangeScale) { + return LogNumericalScale().getWidth(v, paint) + 10; // for piano + } else { + return LinearNumericalScale().getWidth(v, paint); } }