[apps/shared] Handle null labelStep in numberOfLabels

This commit is contained in:
Hugo Saint-Vignes
2021-01-05 16:21:00 +01:00
committed by LeaNumworks
parent 9f0c7a87fd
commit a42208f773

View File

@@ -187,6 +187,9 @@ float CurveView::gridUnit(Axis axis) const {
int CurveView::numberOfLabels(Axis axis) const {
float labelStep = 2.0f * gridUnit(axis);
if (labelStep <= 0.0f) {
return 0;
}
float minLabel = std::ceil(min(axis)/labelStep);
float maxLabel = std::floor(max(axis)/labelStep);
int numberOfLabels = maxLabel - minLabel + 1;